Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

object-fit

3 tags 1 category

The object-fit CSS property sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container.

Note: The object-fit property has no effect on <iframe>, <embed>, and <fencedframe> elements.

You can alter the alignment of the replaced element’s content object within the element’s box using the object-position property.

Values: This property is specified as one of the following keyword values:

Values: contain The replaced content is scaled to maintain its aspect ratio while fitting within the element’s content box. The entire object is made to fill the box, while preserving its aspect ratio, so the object will be “letterboxed”>) or “pillarboxed” if its aspect ratio does not match the aspect ratio of the box. cover The replaced content is sized to maintain its aspect ratio while filling the element’s entire content box. If the object’s aspect ratio does not match the aspect ratio of its box, then the object will be clipped to fit. fill The replaced content is sized to fill the element’s content box. This is the initial value. The entire object will completely fill the box.

Syntax example: object-fit: contain;

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…