CSS z-indexProperty


Example

Set the z-index of the image:

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

Try it Yourself »

Property definition and usage instructions

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

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

Note:z-index enterlinePositioningelement(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 supports the property.

Property
z-index 1.0 4.0 3.0 1.0 4.0

Property value

Value Description
auto Default. The stacking order is equal to that of the parent element.
number Set the stacking order of the element.
inherit Specifies that the value of the z-index property should be inherited from the parent element.


Related Articles

CSS Tutorial:CSS Positioning

other extensions