CSS
CSS Z-IndexCSS Z-Index
CSS z-index controls the vertical stacking order of elements.
Read Time
5 min readDifficulty
BeginnerLast Updated
Jun 15, 2026Version
v1.0.0Introduction
CSS layers elements on top of each other when they overlap. The `z-index` property tells the browser which element sits in front. Higher numbers stay on top, while negative numbers sink to the back.
Syntax
Syntax
Example
Example
Key Points
- Elements with a higher `z-index` sit in front.
- Elements with a lower `z-index` hide behind.
- The property only works on positioned elements.
- It accepts positive and negative whole numbers.