Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS z-index property


May 06, 2021 CSS Reference Manual


Table of contents


CSS z-index property

Description of property definition and use

The z-index property specifies the stacking order of an element.

Elements with a higher stack order are always in front of elements with a lower stack order.

Note: z-index locates elements (position:absolute, position:relative, or position:fixed).

Default: auto
Inherited: no
Version: CSS2
JavaScript syntax: object .style.zIndex="1"

The property value

Value Describe
auto Default. The stacking order is equal to that of the parent element.
number Set the stacking order of the elements.
inherit Specifies that the value of the z-index property should be inherited from the parent element.

Browser support

The numbers in the table support the first browser version number of the property.

Attributes
z-index 1.0 4.0 3.0 1.0 4.0

Set the z-index of the image:

Img
{
position:absolute;
left:0px;
top:0px;
z-index:-1;
}

Try it out . . .

Related articles

CSS tutorial: CSS Positioning