Syntax : | z-index : <value> |
Possible Values : | auto | integer | inherit |
Initial value : | auto |
Applies to : | positioned elements |
Inherited : | no |
For a positioned box, the 'z-index' property specifies :
Values have the following meanings :
integer
This integer is the stack level of the generated box in the current stacking context. The box also establishes a local stacking context in which its stack level is '0'.
auto
The stack level of the generated box in the current stacking context is the same as its parent's box. The box does not establish a new local stacking context.
In the following example, the stack levels of the boxes (named with their "id" attributes) are :
"text2"=0, "image"=1, "text3"=2, and "text1"=3.
The "text2" stack level is inherited from the root box.
The others are specified with the 'z-index' property.
The above example demonstrates the notion of transparency. The default behavior of a box is to allow boxes behind it to be visible through transparent areas in its content. In the example, each box transparently overlays the boxes below it. This behavior can be overridden by using one of the existing background properties.