Easy Tutorial
❮ Css3 Pr Border Bottom Left Radius Css3 Pr Transition Delay ❯

CSS z-index Property

Example

Set the z-index of an image:

img {
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: -1;
}

Property Definition and Usage

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

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

Note: z-index only works on positioned elements (position: absolute, position: relative, or position: fixed).

Default value: auto
Inherited: no
--- ---
Version: CSS2
--- ---
JavaScript syntax: object.style.zIndex="1"
--- ---

Browser Support

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

Property
z-index 1.0 4.0 3.0 1.0 4.0

Property Values

Value Description
auto Default. The stacking order is the same as the parent.
number Sets the stacking order of the element.
inherit Specifies that the z-index should be inherited from the parent element.

Related Articles

CSS Tutorial: CSS Positioning

❮ Css3 Pr Border Bottom Left Radius Css3 Pr Transition Delay ❯