CSS z-index Property


The z-index CSS property specifies the layering or stacking order for the positioned elements i.e. elements whose position value is one of absolute, fixed, or relative. The stacking order refers to the position of elements along the Z-axis which is perpendicular to the screen.

The z-index property specifies the stack order of an element.

An element with greater stack order is always in front of an element with a lower stack order.

CSS Syntax

z-index: auto|number|initial|inherit;

Example -