Also called: stacking context, layer order
In plain English
It only works on positioned elements (or flex/grid children), and only within the same stacking context. "z-index: 9999 doesn't work" almost always means a parent created a new stacking context (for example with transform or opacity).
Example
The menu hid behind the map until I fixed the stacking context.
Learn more
- Understanding z-indexMDN Web Docs (opens in a new tab)
- Stacking contextMDN Web Docs (opens in a new tab)
Related terms
Added 2026-11-30 · Last reviewed 2026-11-30