Object Fit
Below, utility classes to apply object-fit
property.
Class | Properties |
---|---|
.object-contain | object-fit: contain; |
.object-cover | object-fit: cover; |
.object-fill | object-fit: fill; |
.object-none | object-fit: inline-none; |
.object-scale-down | object-fit: scale-down; |
Example(s)
html
<picture class="w-64 ...">
<!-- <source /> -->
<img class="h-48 object-contain" />
</picture>
html
<picture>
<!-- <source /> -->
<img class="w-64 h-48 object-cover" />
</picture>
html
<picture class="w-64 h-64 ...">
<!-- <source /> -->
<img class="w-64 h-48 object-fill" />
</picture>
html
<picture>
<!-- <source /> -->
<img class="w-64 h-64 object-none" />
</picture>
html
<picture class="w-64 h-64 ...">
<!-- <source /> -->
<img class="w-48 h-64 object-scale-down" />
</picture>