CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES
Advertisements

CSS z-index Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The z-index CSS property specifies the layering or stacking order for the positioned elements i.e. elements whose position value is one of absolute, fixed, or relative. The stacking order refers to the position of elements along the Z-axis which is perpendicular to the screen.

The following table summarizes the usages context and the version history of this property.

Default value: auto
Applies to: Positioned elements
Inherited: No
Animatable: Yes. See animatable properties.
Version: CSS 2, 3

Note: When elements overlap, z-index determines which one overlaps the other. An element with a higher z-index generally overlaps an element with a lower one.


Syntax

The syntax of the property is given with:

z-index: 
integer | auto | initial | inherit

The example below shows the z-index property in action.

div {
    position: absolute;
    lop: 30px;
    left: 30px;
    z-index: 2;
}

Property Values

The following table describes the values of this property.

Value Description
integer Sets the stack level of the element's box in the current stacking context. The box also establishes a local stacking context in which its stack level is 0 (zero). Negative integer values are allowed.
auto The stack level of the element's box is the same as its parent's box, and doesn't establish a new stacking context. This is default value.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element z-index property.

Browser Compatibility

The z-index property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 4+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: CSS Position, CSS Layers.

Related properties: position, top, right, left, bottom.

Advertisements
Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties