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.

HTML
<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

ClassCSS declarations
inset-0inset: 0px;
inset-x-4inset-inline: 1rem;
inset-y-2inset-block: 0.5rem;
top-2top: 0.5rem;
right-2right: 0.5rem;
bottom-0bottom: 0px;
left-1/2left: 50%;
start-4inset-inline-start: 1rem;
end-4inset-inline-end: 1rem;
-top-1top: -0.25rem;
inset-autoinset: auto;
View full generated CSS
Compiled 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;
}