Skip to content

object-fit

Utilities for controlling how a replaced element’s content should be resized.

Class Effect
object-contain object-fit: contain;
object-cover object-fit: cover;
object-fill object-fit: fill;
object-none object-fit: none;
object-scale-down object-fit: scale-down;

Use object-cover to fill the box while keeping the image’s aspect ratio, cropping what does not fit.

object-fit: Resizing to coverobject-fit: Resizing to cover
ui.image(DEMO_IMAGE, "h-48 w-96 rounded-lg bg-gray-200 object-cover dark:bg-white/5")
object-fit: Containing withinobject-fit: Containing within
ui.image(DEMO_IMAGE, "h-48 w-96 rounded-lg bg-gray-200 object-contain dark:bg-white/5")
object-fit: Stretching to fitobject-fit: Stretching to fit
ui.image(DEMO_IMAGE, "h-48 w-96 rounded-lg bg-gray-200 object-fill dark:bg-white/5")