Stacking order
What sits on top of what: sticky bars under drawers, drawers under dialogs, tooltips over everything. Momo uses a small, fixed ladder so the parts never fight, and most pop-ups do not need it at all.
Pop-ups are always on top
Dialogs, drawers, dropdown menus, the dropdown list, calendars, toasts and the command palette open in the browser's top layer. That layer is above the whole page whatever the page's own stacking says, so a menu is never cut off by a card with overflow: hidden and never ends up under a sticky header. You do not set anything for them.
The ladder for the page itself
| Level | What uses it |
|---|---|
| 1 to 10 | Small things inside a component: a sticky table header, a badge on a corner, a carousel arrow |
| 20 | Sticky bars: .sticky-top, .sticky-bottom, the app's top bar |
| 25 | The back-to-top button |
| 30 | Fixed bars: .fixed-top, .fixed-bottom, a sticky or fixed navbar |
| 40 | The phone tab bar, the scroll progress line |
| 45 | The cookie banner |
| 55 and 60 | The app sidebar as a drawer on phones, with its backdrop; the shortcuts hint |
| 100 | The skip link when it has the focus |
| 1000 | What follows the pointer: a dragged row or card, the menu of a table cell |
| 2000 | Tooltips |
For your own parts
The z-* utilities cover the low end, which is where your own content belongs. Stay under 20 and you stay under every bar; go above only when you mean to cover one.
z-0
z-10
z-20
<div class="relative" style="height: 7rem; max-width: 18rem" id="st-demo">
<div class="box p-3 bg-yellow absolute z-0" style="inset: 0 4rem 2rem 0">z-0</div>
<div class="box p-3 bg-pink absolute z-10" style="inset: 1rem 2rem 1rem 2rem">z-10</div>
<div class="box p-3 bg-cyan absolute z-20" style="inset: 2rem 0 0 4rem">z-20</div>
</div><div class="relative">
<div class="absolute z-0">…</div>
<div class="absolute z-10">…</div>
</div>z-0,z-10,z-20,z-30,z-40,z-50andz-autoare there.isolateon a wrapper keeps what is inside from climbing over what is outside: its numbers only count among themselves.- If something hides behind a sticky bar, it is usually because a parent has a low level. Raise the parent, not the child.