What is the purpose of the z-index ?

What is the purpose of the z-index ?

Senior Developer Asked on December 6, 2017 in CSS.
Add Comment
1 Answer(s)

The z-index CSS property specifies the z-order of a positioned element and its descendants.z-index only works on positioned elements (position:absolute, position:relative, or position:fixed).

Example:

Set the z-index for an image:


img {

position: absolute;

left: 10px;

top: 10px;

z-index: -1;

}

IT Head Answered on January 22, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.