Object fit
Utilities for controlling how a replaced element's content should be resized
Class reference
Contain
Resize an element’s content to stay contained within its container using .object-contain
.
Cover
Resize an element’s content to cover its container using .object-cover
.
Fill
Stretch an element’s content to fit its container using .object-fill
.
None
Display an element’s content at its original size ignoring the container size using .object-none
.
Scale Down
Display an element’s content at its original size but scale it down to fit its container if necessary using .object-scale-down
.
Responsive
To control how a replaced element’s content should be resized only at a specific breakpoint, add a {screen}:
prefix to any existing object fit utility. For example, adding the class md:object-scale-down
to an element would apply the object-scale-down
utility at medium screen sizes and above.
<div>
<img class="object-contain **md:object-scale-down** ..." src="...">
</div>
For more information about Elements’ responsive design features, check out the Responsive Design documentation.
On this Page
v1.13.5