how to set the zindex value of the child div's greater than parent div. where parent zindex differs.
+2
A:
Positioning contexts nest. A descendant div's z-index
only has to be higher than other descendant divs in the same positioned ancestor in order for it to appear on top. A positioned child will appear on top of the positioned parent even if it has a lower z-index
.
At no time is it necessary for an element to know about its positioned-ancestor's z-index
.
bobince
2010-10-27 11:17:51
+1
A:
If you really want to know how to do this...
node.style.zIndex = node.parentNode.style.zIndex + 1;
node is the child div.
Thomas F.
2010-10-27 15:18:27
This will only work if `parentNode` sets its z-index in a style attribute.
Zack
2010-10-27 15:25:43
incase what would be if i'm unable to access the parent node's div
laki
2010-10-28 08:37:29