Browse documentation

Reference / Layout

Object position

Choose which part of a cropped image stays visible when its frame cuts off the edges.

Working example

Both frames show the same source. Shift the focal point toward a subject near an edge, using percentages for finer control.

HTML
<div class="flex gap-3">
  <img class="size-20 object-cover object-left" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='80' viewBox='0 0 160 80'%3E%3Crect width='160' height='80' fill='%23ddd'/%3E%3Ccircle cx='32' cy='40' r='25'/%3E%3Crect x='100' y='15' width='50' height='50' fill='%23777'/%3E%3C/svg%3E" alt="Circle at the left edge">
  <img class="size-20 object-cover object-right" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='80' viewBox='0 0 160 80'%3E%3Crect width='160' height='80' fill='%23ddd'/%3E%3Ccircle cx='32' cy='40' r='25'/%3E%3Crect x='100' y='15' width='50' height='50' fill='%23777'/%3E%3C/svg%3E" alt="Square at the right edge">
</div>

Class reference

ClassCSS declarations
object-leftobject-position: left;
object-centerobject-position: center;
object-rightobject-position: right;
object-left-topobject-position: left top;
object-right-bottomobject-position: right bottom;
object-[25%_50%]object-position: 25% 50%;
View full generated CSS
Compiled CSS
.object-\[25\%_50\%\] {
  object-position: 25% 50%;
}
.object-center {
  object-position: center;
}
.object-left {
  object-position: left;
}
.object-left-top {
  object-position: left top;
}
.object-right {
  object-position: right;
}
.object-right-bottom {
  object-position: right bottom;
}