Re:What No One Told You About Z-Index
by taylorfausak on Tuesday January 15, 2013 @04:23PM
(#5063093)
The key takeaway:
I had no idea that was the case. The CSS 2.1 spec [1] notes that "other properties may introduce stacking contexts, for example
'opacity'". The CSS 3 spec [2] elaborates:
[1]: http://www.w3.org/TR/CSS2/visuren.html#z-index
[2]: http://www.w3.org/TR/2010/PR-css3-color-20101028/#transparen...
[ Parent
| on HN ]
My main takeaway was the following:
Z-index only works on positioned elements. If you
try to set a z-index on an element with no position
specified, it will do nothing.
I know I have scratched my head in the past trying to get z-index do what I want, and this knowledge probably would have helped!