Control how replaced elements (img, video) fill their box: cover, contain, fill, none, scale-down — and where they anchor. This family contains 14 generated classes in Nakshora 3.0.
Classes#
| Class | Generated CSS |
|---|---|
object-contain | object-fit: contain; |
object-cover | object-fit: cover; |
object-fill | object-fit: fill; |
object-none | object-fit: none; |
object-scale-down | object-fit: scale-down; |
object-bottom | object-position: bottom; |
object-center | object-position: center; |
object-left | object-position: left; |
object-left-bottom | object-position: left bottom; |
object-left-top | object-position: left top; |
object-right | object-position: right; |
object-right-bottom | object-position: right bottom; |
object-right-top | object-position: right top; |
object-top | object-position: top; |
Example#
example
<img class="h-64 w-full object-cover object-center" src="hero.jpg" alt="Sunset over Dhaka" />Responsive & variants#
Every class here accepts screen prefixes (sm: … xl:) and state variants — md:hover:p-4 style stacks compile to a single media query. See responsive/index|Responsive design and variants/index|Variants.
Best practices#
object-cover+ fixed height is the canonical card image pattern- Pair with
aspect-videofor predictable media slots
Common mistakes#
- object-* only affects replaced elements — it does nothing on a div
Related#
utilities/spacing/margin|Margin · utilities/sizing/width|Width · responsive/index|Responsive
