Skip to main content

Z-index

Control the stacking order of overlapping elements with the .z-* utilities.

Z-index utilities

Set the z-index of an element directly:

z-30
z-20
z-10
<div class="z-30">On top</div>
<div class="z-10">Beneath</div>

Available: .z-0, .z-10, .z-20, .z-30, .z-40, .z-50, and .z-auto.

Component z-indexes

boodoo's components use well-defined z-index values so that dropdowns stack under navbars, modals above everything, etc. These are exposed as CSS custom properties for tweaking:

Component CSS variable Default
Dropdown --boodoo-zindex-dropdown 1000
Sticky/fixed --boodoo-zindex-sticky/fixed 1020 / 1030
Offcanvas --boodoo-zindex-offcanvas 1045
Modal --boodoo-zindex-modal 1055
Popover --boodoo-zindex-popover 1070
Tooltip --boodoo-zindex-tooltip 1080
Toast --boodoo-zindex-toast 1090
.my-modal {
  --boodoo-zindex-modal: 2000;  /* pushes it above the default */
}