diff --git a/site/content/docs/0.0/utilities/object-fit.md b/site/content/docs/0.0/utilities/object-fit.md index 17386939dc..daa13b29cd 100644 --- a/site/content/docs/0.0/utilities/object-fit.md +++ b/site/content/docs/0.0/utilities/object-fit.md @@ -8,4 +8,58 @@ aliases: toc: true --- -{{< callout-soon "page" >}} +## How it works + +Change the value of the [`object-fit` property](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) with our `object-fit` utility classes. This property tells the content to fill the parent container in a variety of ways, such as preserving the aspect ratio or stretching to take up as much space as possible. + +Classes for the value of `object-fit` are named using the format `.object-fit-{value}`. Choose from the following values: + +- `contain` +- `cover` +- `fill` +- `scale` (for scale-down) +- `none` + +## Examples + +Add the `object-fit-{value}` class to the [replaced element](https://developer.mozilla.org/en-US/docs/Web/CSS/Replaced_element): + +{{< example class="d-flex overflow-auto" >}} +{{< placeholder width="140" height="120" class="object-fit-contain border" text="Object fit contain" markup="img" color="#333" background="#bbb" >}} +{{< placeholder width="140" height="120" class="object-fit-cover border" text="Object fit cover" markup="img" color="#333" background="#bbb" >}} +{{< placeholder width="140" height="120" class="object-fit-fill border" text="Object fit fill" markup="img" color="#333" background="#bbb" >}} +{{< placeholder width="140" height="120" class="object-fit-scale border" text="Object fit scale down" markup="img" color="#333" background="#bbb" >}} +{{< placeholder width="140" height="120" class="object-fit-none border" text="Object fit none" markup="img" color="#333" background="#bbb" >}} +{{< /example >}} + + + +## Video + +The `.object-fit-{value}` and responsive `.object-fit-{breakpoint}-{value}` utilities also work on `