z-index CSS property specifies the layering or stacking order for the positioned elements i.e. elements whose
position value is one of
relative. The stacking order refers to the position of elements along the Z-axis which is perpendicular to the screen.
The following table summarizes the usages context and the version history of this property.
|Yes. See animatable properties.
|CSS 2, 3
Note: When elements overlap,
z-index determines which one overlaps the other. An element with a higher
z-index generally overlaps an element with a lower one.
The syntax of the property is given with:
The example below shows the
z-index property in action.
ExampleTry this code »
The following table describes the values of this property.
|Sets the stack level of the element's box in the current stacking context. The box also establishes a local stacking context in which its stack level is 0 (zero). Negative integer values are allowed.
|The stack level of the element's box is the same as its parent's box, and doesn't establish a new stacking context. This is default value.
|Sets this property to its default value.
|If specified, the associated element takes the computed value of its parent element
z-index property is supported in all major modern browsers.