Who's in Charge Here?
z-index is depth (layers). But it doesn't work as simply as it seems.
1. Stacking Context
This is a " group of layers " . Imagine you live in a two-story house:
- If you're higher than your neighbor in the room (z-index property), you're " above " .
- But if you're on the 1st floor and neighbor is on the 2nd, no matter how high your stool (z-index) is — the neighbor on the 2nd floor will ALWAYS be above you to an outside observer.
2. What Creates a New Context?
position: absolute/relative+z-index(notauto).opacityless than 1.transform(any, evenscale(1)).filter,perspective.
Important
If your modal header with z-index: 9999 suddenly ends up UNDER another element, check the parents. Most likely, they created a new stacking context that's lower than the neighbor.