Introduction
CSS Classes
React Components
Cssville has 10 utility classes for object-fit. Add one to an element's class attribute to set the property, for example obj-fit-cover. Put a breakpoint name in front of a class to apply it only on screens up to that width, as in md-obj-fit-cover. Add -hover to the end to apply a class only on hover, as in obj-fit-cover-hover. Getting started explains how class names are built.
| Class name prefix | CSS properties |
|---|---|
| obj-fit-* | object-fit |
| Class name suffix | CSS properties value |
|---|---|
| *-contain | contain |
| *-cover | cover |
| *-fill | fill |
| *-none | none |
| *-scale-down | scale-down |
| *-inherit | inherit |
| *-initial | initial |
| *-revert | revert |
| *-revert-layer | revert-layer |
| *-unset | unset |
.obj-fit-contain {
object-fit: contain;
}