Coding Ninjas Logo

Home > CSS Questions > What is the purpose of the z-index and how is it used?

Q : What is the purpose of the z-index and how is it used?


Answer:

The z-index helps to specify the stack order of positioned elements that may overlap one another. The z-index default value is zero and can take on either a positive or negative number.

An element with a higher z-index is always stacked above than a lower index.

z-index can take the following values:


Similar Questions