Utilities
Position
Take something out of the flow: pin it to a corner, stick it to the top while scrolling, or layer it over something else.
top-2 start-2
bottom-2 end-2
relative parent
<div class="relative bg-1 rounded-lg h-36">
<div class="absolute top-2 start-2">top-2 start-2</div>
<div class="absolute bottom-2 end-2">bottom-2 end-2</div>
<div class="absolute inset-0 flex items-center justify-center text-sm text-muted">relative parent</div>
</div>
A badge on a corner
3
<span class="relative inline-block">
<button class="btn btn-icon" aria-label="Inbox">
<i class="mi mi-inbox"></i>
</button>
<span class="badge badge-corner">3</span>
</span>
Sticky
Sticky header
Row 1
Row 2
Row 3
Row 4
Row 5
Row 6
Row 7
Row 8
<div class="overflow-y-auto bg-surface rounded-lg h-40">
<div class="sticky top-0 z-10 bg-blur p-3 font-semibold">Sticky header</div>
<div class="space-y-2 p-3">
<div>Row 1</div>
<div>Row 2</div>
<div>Row 3</div>
<div>Row 4</div>
<div>Row 5</div>
<div>Row 6</div>
<div>Row 7</div>
<div>Row 8</div>
</div>
</div>
Stacking
z-0 to z-50 for your own layers; z-sticky, z-menu, z-toast … use Moey's own layers, so your element stacks correctly against menus and toasts.
Cover a box
absolute inset-0 fills the nearest relative parent — overlays, "loading" covers, a whole-card link.
Content under the cover
More content
Loading…
<div class="relative rounded-lg overflow-hidden h-40 bg-2">
<div class="p-4 space-y-2">
<div>Content under the cover</div>
<div>More content</div>
</div>
<div class="absolute inset-0 bg-blur grid place-items-center">
<span class="inline-flex items-center gap-2 text-sm font-medium"><span class="spinner spinner-sm"></span>Loading…</span>
</div>
</div>
Fixed
fixed stays put while the page scrolls — a "back to top" button or a bottom bar on phones: fixed bottom-0 inset-x-0. (Not shown here, it would cover the docs.)
| Class | Does |
|---|---|
static · relative · absolute · fixed · sticky | position · with breakpoints (lg:sticky) |
inset-0 · inset-x-0 · inset-y-0 · top-0 · bottom-0 · start-0 · end-0 | offsets — also 1, 2, 3, 4, 6, 8 (× 4px), full, 1/2, auto |
z-0 · z-10 · z-20 · z-30 · z-40 · z-50 · z-auto | stacking order |
z-sticky · z-fixed · z-menu · z-toast · z-tooltip | Moey's layers |