Skip to content

E304 - object_fit is forbidden when a dimension is "auto"

Cause

An image or image_sequence element specifies object_fit: but has one of width: / height: as "auto". The auto-sized dimension already follows the image's intrinsic aspect ratio, so object_fit has no effect and is rejected to avoid confusion.

Example

{ image: "a.png", width: "auto", height: 50, object_fit: "cover" }

How to fix

Remove the object_fit field — the "auto" dimension already handles the fit.