Can someone explain z-index to me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can someone explain z-index to me?

7th Feb 2016, 2:35 PM
Josh Washington
Josh Washington - avatar
5 Answers
+ 2
if tow or more elements overlap each other the element with most z-index value will be top others and this rule applies to other elements on stack
24th Feb 2016, 6:01 AM
amir nassaji
amir nassaji - avatar
+ 2
elements on the page are positioned along an x-axis (horizontal) and y-axis (vertical). z-axis is toward the viewer, so a higher z value will position an element 'closer' to the viewer. Since we're dealing with a 2D representation, those elements will overlap others that are behind it.
11th Aug 2016, 3:17 PM
Andres Mar
+ 1
It's only about overlapping each other. An element with a z-index of 2 is overlapping an element with a z-index of 1, an element with a z-index of 3 is overlapping an element with a z-index of 2 and so on...
16th Mar 2016, 10:24 PM
Blub
0
the default z-index value is 0 when two elements overlap the one with higher z-index is shown above the other. you can set any z-index value > 0 to show it over the other element the element with more z-index value is shown over
23rd Jun 2016, 1:38 PM
Sumanth Reddy
Sumanth Reddy - avatar
0
the web page is two dimensional (2D).. but to understand the overlapping effect and to manage the same, third dimension I.e. z-axis which is pointing towards you out of the screen can be imagined. more the z-index more virtually it's above other elements
17th Oct 2016, 4:41 PM
Sumeet Nagpal
Sumeet Nagpal - avatar