Export (0) Print
Expand All

z-index

Sets the stacking order of positioned objects.

{ z-index: vOrder}

vOrder

Variant that specifies or receives one of the following values:

auto

Default. String that specifies the stacking order of the positioned objects based on the order in which the objects appear in the HTML source.

order

Integer that specifies the position of the object in the stacking order.

The property has a default value of auto. It is not inherited.

Positive z-index values are positioned above a negative (or lesser-value) z-index. Two objects with the same z-index are stacked according to source order. A positive value positions the element above text that has no defined z-index, and a negative value positions it below. Set this parameter to null to remove the property.

The z-index property applies only to objects that have the position property set to relative or absolute.

The property does not apply to windowed controls, such as select objects.

Input from a pointing device, such as a mouse, does not penetrate through overlapping elements even if the elements are not visible. This is also true for positioned elements with a negative z-index unless:

  • The parent is a scrolling container (that is, its overflow property is set to auto or scroll).

  • The parent is positioned (that is, its position property is set to absolute, relative, or fixed).

The following example uses the z-index property to change the stacking order of objects. This example uses an inline style sheet to set the stacking order:

<img src="cone.jpg" style="position:absolute; 
    top:100px; left:100px; z-index:4"/>
<div style="position:absolute; top:100; left:100;
    color:red; background-color:beige; font-weight:bold; 
    z-index:1">
. . . </div>

A, ADDRESS, APPLET, B, BIG, BLOCKQUOTE, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, CUSTOM, DD, DEFAULTS, DFN, DIV, DL, DT, EM, FIELDSET, FORM, I, IFRAME, INPUT TYPE=BUTTON, INPUT TYPE=CHECKBOX, INPUT TYPE=FILE, INPUT TYPE=IMAGE, INPUT TYPE=PASSWORD, INPUT TYPE=RADIO, INPUT TYPE=RESET, INPUT TYPE=SUBMIT, INPUT TYPE=TEXT, LI, OL, P, S, SPAN, SUB, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP

Community Additions

ADD
Show:
© 2014 Microsoft