Z-index

Description:
This property specifies the stack level of a box whose position value is one of absolute, fixed, or relative.
The stack level refers to the position of the box along the z axis, which runs perpendicular to the display. The higher the value, the closer the box is to the user; in other words, a box with a high z-index will obscure a box with a lower z-index occupying the same location along the x and y axes.

Example:

This style rule makes the element with ID "warning" absolutely positioned and assigns it a higher stack level than its siblings:
#warning {
  position: absolute;
  z-index: 1;
}

Value:

An integer value—which can be negative—sets the stack level of the box in the current stacking context, and also establishes a new stacking context. The box itself has stack level 0 (zero) in the new context.

The value auto gives the box the same stack level as its parent, and doesn’t establish a new stacking context.

No comments:

Post a Comment