Browse documentation
Reference / Layout
Inset and offsets
Set the distance between a positioned element and one or more edges. Use logical start and end offsets for layouts that switch writing direction.
Working example
Giving a caption both inline offsets lets its width follow the containing image as the viewport changes.
<figure class="relative h-24 bg-neutral-200">
<figcaption class="absolute inset-x-3 bottom-3 border bg-white px-3 py-1">
Plate 08 · South elevation
</figcaption>
</figure>Class reference
| Class | CSS declarations |
|---|---|
inset-0 | inset: 0px; |
inset-x-4 | inset-inline: 1rem; |
inset-y-2 | inset-block: 0.5rem; |
top-2 | top: 0.5rem; |
right-2 | right: 0.5rem; |
bottom-0 | bottom: 0px; |
left-1/2 | left: 50%; |
start-4 | inset-inline-start: 1rem; |
end-4 | inset-inline-end: 1rem; |
-top-1 | top: -0.25rem; |
inset-auto | inset: auto; |
View full generated CSS
.inset-0 {
inset: 0px;
}
.inset-auto {
inset: auto;
}
.inset-x-4 {
inset-inline: 1rem;
}
.inset-y-2 {
inset-block: 0.5rem;
}
.-top-1 {
top: -0.25rem;
}
.bottom-0 {
bottom: 0px;
}
.end-4 {
inset-inline-end: 1rem;
}
.left-1\/2 {
left: 50%;
}
.right-2 {
right: 0.5rem;
}
.start-4 {
inset-inline-start: 1rem;
}
.top-2 {
top: 0.5rem;
}