Advertisement

Google Ad Slot: content-top

CSS Z-index

~1 min read · CSS
On this page

The z-index property in CSS controls the stacking order of elements along the z-axis (i.e., front-to-back order). It determines which elements appear in front of or behind other elements on the page.


Syntax:

z-index: <value>;


Value:Positive, negative, or 0 (e.g., 1, 100, -1).


Example
Try it yourself

Rule of using Z-index

The element must have a position value of:relative,absolute,fixed,sticky

Elements with a higher z-index will appear in front of elements with a lower z-index.