Menu Samaritan's Purse

OBJECT-FIT

The object-fit property specifies how the contents of a replaced element should be fitted to the box established by its used height and width.

SYNTAX

CSS

object-fit: value;

JS

object.style.objectFit = "value";

VALUES

<'object-fit'> = fill | contain | cover | none | scale-down
fill

The replaced content is sized to fill the element's content box.

contain

The replaced content is sized to maintain its aspect ratio while fitting within the element's content box.

cover

The replaced content is sized to maintain its aspect ratio while filling the element's entire content box.

none

The replaced content is not resized to fit inside the element's content box.

scale-down

Sizes the content as if none or cover were specified, whichever would result in a smaller concrete object size.

INITIAL

fill

EXAMPLES

CONTAIN

COVER

FILL

NONE

SCALE-DOWN

JS

INTERNAL

object-position

EXTERNAL

World Wide Web Consortium (W3C)