CSS z-index Property

❮ Previous Reference Next ❯

Example

img {
  position: absolute;
  z-index: -1;
}

Meaning

The z-index property defines a layering or stacking context for positioned elements.

Note: The 0 being the default z-index level.

Overlapping elements with a larger z-index cover those with a smaller one.

Default value:auto
Inherited:No
Animatable:Yes
Version:CSS2
JavaScript syntax:
object.style.zIndex="auto|number|initial|inherit|revert|revert-layer|unset";



Standard Syntax

z-index: auto|number|initial|inherit|revert|revert-layer|unset;



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







Property Values

The following table describes the values of this property.

Value Description
auto This is default value. The auto value tries to determine the z-placement of an element automatically by its markup position in the document.
number Specifies the layering values to an element, with higher numbers layering above lower numbers. Negative numbers are allowed.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.



Default CSS Property Values

selectors {
  z-index: auto;
}
❮ Previous Reference Next ❯