Skip to content

Object Fit

Use object fit utilities to control how an image or media element is resized to fit its container. These map directly to Flutter’s BoxFit values.

Style('h-48 w-96 object-cover ...', child: Image.network('/img/mountains.jpg'))
Style('h-48 w-96 object-contain ...', child: Image.network('/img/mountains.jpg'))
Style('h-48 w-96 object-fill ...', child: Image.network('/img/mountains.jpg'))
Style('h-48 w-96 object-scale-down ...', child: Image.network('/img/mountains.jpg'))
Style('h-48 w-96 object-none ...', child: Image.network('/img/mountains.jpg'))
ClassFlutter equivalentDescription
object-coverBoxFit.coverResize to cover the container, cropping if needed
object-containBoxFit.containResize to fit within the container
object-fillBoxFit.fillStretch to fill the container
object-noneBoxFit.noneDisplay at natural size
object-scale-downBoxFit.scaleDownScale down to fit, but never scale up