+ 2
Can someone explain z-index to me?
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
+ 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.
+ 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...
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
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