← Back to properties
CSS Property
z-index
PositioningControls the stacking order of positioned elements.
Syntax
z-index: value;
Example
z-index: 10;
Common use cases
- Keeping modals above page content
- Dropdown menus over other elements
- Layering background and foreground elements
Practical developer insight
z-index often fails because the element is inside a different stacking context. Properties like opacity, transform, or filter can silently create one — check your parent chain.