What is z index | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
7 Answers
+ 3
It determines the stacking order of positioned elements on a web page. It is used to control how elements are layered and displayed on top of each other along the z-axis, which represents the depth or "third dimension" of the page.
13th Jun 2023, 6:40 PM
Vaibhav
Vaibhav - avatar
+ 3
Sandeep Bigger nummber in z-index -> the element displays less deep in the foreground Lower number in z-index -> the element goes to the background
12th Jun 2023, 7:18 AM
Ugulberto Sánchez
Ugulberto Sánchez - avatar
+ 3
https://developer.mozilla.org/ is always a good reference I always think of it like layers in Photoshop. Bigger numbers are on top of smaller ones. Negatives move elements behind. https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
12th Jun 2023, 9:19 AM
Bob_Li
Bob_Li - avatar
+ 2
In your CSS, change this line to: .special { z-index: 3; Then run your code. I think you'll understand, once you see the difference.
12th Jun 2023, 7:00 AM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Ok
12th Jun 2023, 9:36 AM
Sandeep
Sandeep - avatar
+ 1
When z index is 3 the 2 elements goes on 1and 3
12th Jun 2023, 7:07 AM
Sandeep
Sandeep - avatar
+ 1
It defines how elements are overlayed, elements with larger z-index will project on top of all those with a smaller z-index
13th Jun 2023, 6:10 PM
Nest Admiral
Nest Admiral - avatar