/

HTML / CSS / JavaScript Tutorial

CSS Property: z-index

[this page | pdf | back links]

The CSS (CSS1) z-index property specifies the stack order of an element, i.e. which is “in front of” other elements, and hence which is visible if several would otherwise appear in the same place. Elements with higher stack order (z-index value) are shown in preference to ones with lower stack order. It only works on positioned elements, i.e. with position:absolute, position:relative or position:fixed.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

number

Stack order set to a specified value (which can be negative)

auto

(default value). Stack order of element set to the same as its parent’s stack order

 

Default Value:

auto

JavaScript syntax:

e.g. object.style.zIndex="-1"

Inherited:

No

Animatable:

Yes

 


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile