- Home
- /
- Tutorials
- /
- CSS Tutorial
- /
- CSS Z-index
CSS Layout
CSS Z-index
The CSS Z-index property controls the stacking order of positioned elements on a webpage.
When two or more elements overlap, the element with the higher z-index value appears in front of the others. The supporting concepts are explained in CSS Position and Normal Flow.
Think of z-index as layers stacked on top of each other:
- Higher z-index = Closer to the user
- Lower z-index = Further behind
Z-index is commonly used for:
- Navigation menus
- Popups and modals
- Tooltips
- Dropdown menus
- Floating buttons
Syntax
CSS Z-index Syntax
css
selector {
z-index: value;
}