CSS z-index property
Examples
Set the image of z-index:
img
{
position: absolute;
left: 0px;
top: 0px;
z-index: -1;
}
{
position: absolute;
left: 0px;
top: 0px;
z-index: -1;
}
Attribute definitions and instructions
z-index attribute specifies the stacking order of elements.
Element has a higher stacking order will always be in front of the lower stacking order of elements.
Note: z-index positioning element (position: absolute, position: relative , or position: fixed).
Defaults: | auto |
---|---|
inherit: | no |
version: | CSS2 |
JavaScript syntax: | object .style.zIndex = "1" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
z-index | 1.0 | 4.0 | 3.0 | 1.0 | 4.0 |
Property Value
value | description |
---|---|
auto | default. The stacking order of the parent element are equal. |
number | Set the stacking order of elements. |
inherit | Provisions should inherit the z-index attribute value from the parent element. |
related articles
CSS tutorial: CSS Positioning