A Demo of the Object Fit Property
The object-fit property alters the way images get resized as their containing box is resized. Note: these are images in the HTML, not background images called by CSS.
-
original image (1920x1080px)
-
object-fit: fill
-
object-fit: contain
-
object-fit: cover
-
object-fit: none
-
object-fit: scale-down
An image that’s larger than its box
-
original image (267x150px)
-
object-fit: fill
-
object-fit: contain
-
object-fit: cover
-
object-fit: none
-
object-fit: scale-down