Browse documentation

Reference / Layout

Z-index

Set the painting order of overlapping items within a stacking context. A higher index brings an item in front of its siblings.

Working example

Compare indexes among siblings in the same stacking context. An ancestor with its own context limits which outside layers a child can overlap.

HTML
<div class="relative isolate h-24">
  <div class="absolute top-2 left-2 z-10 border bg-white p-2">Cover proof</div>
  <div class="absolute top-7 left-8 bg-black p-2 text-white">Inside spread</div>
</div>

Class reference

ClassCSS declarations
z-0z-index: 0;
z-10z-index: 10;
z-20z-index: 20;
-z-10z-index: -10;
z-[100]z-index: 100;
z-[auto]z-index: auto;
View full generated CSS
Compiled CSS
.-z-10 {
  z-index: -10;
}
.z-0 {
  z-index: 0;
}
.z-10 {
  z-index: 10;
}
.z-20 {
  z-index: 20;
}
.z-\[100\] {
  z-index: 100;
}
.z-\[auto\] {
  z-index: auto;
}