Object fit

Atomic classes that control the sizing of an img or video relative to its container.

Classes

ClassOutputDefinition
.of-containobject-fit: containFit the content to the content box while preserving its aspect ratio. This may result in empty space in the content box.
.of-coverobject-fit: coverCover the entire content box with the content while preserving its aspect ratio. This may crop the content.
.of-fillobject-fit: fillStretch and scale the content's dimensions to match its content box. <em>This is the default browser value.</em>
.of-noneobject-fit: nonePrevent the content from being resized.
.of-scale-downobject-fit: scale-downWhen larger than the content box, resize the content to fill its content box. Otherwise, maintain the content's original dimensions.
.op-centerobject-position: centerCenter the content within its content box.

Examples

<img class="of-contain" src="…" />
<img class="of-cover" src="…" />
<img class="of-fill" src="…" />
<img class="of-none" src="…" />
<img class="of-scale-down" src="…" />
<img class="of-none op-center" src="…" />
.of-contain
placeholder for .of-contain placeholder for .of-contain
.of-cover
placeholder for .of-cover placeholder for .of-cover
.of-fill
placeholder for .of-fill placeholder for .of-fill
.of-none
placeholder for .of-none placeholder for .of-none
.of-scale-down
placeholder for .of-scale-down placeholder for .of-scale-down
.op-center.of-none
placeholder for .op-center.of-none placeholder for .op-center.of-none