object-fit

102

/* 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. 

The position of the replaced element can be affected using CSS,
but not the contents of the replaced element itself.
Some replaced elements, such as <iframe> elements,
may have stylesheets of their own, but they don't inherit the styles
of the parent document. */

/* Global */
object-fit: inherit;
object-fit: initial;
object-fit: revert;
object-fit: unset;

/* VALUES */

object-fit: 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" if its aspect ratio does not match the aspect ratio
of the box.
*/

object-fit: 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.
*/

object-fit: fill;

/*
The replaced content is sized to fill the element’s content box.
The entire object will completely fill the box. 
If the object's aspect ratio does not match the aspect ratio of its box,
then the object will be stretched to fit.
*/

object-fit: none;
/*
The replaced content is not resized.
*/

object-fit: scale-down;

/*
The content is sized as if none or contain were specified, 
whichever would result in a smaller concrete object size.
*/

Comments

Submit
0 Comments