What No One Told You About Z-Index
philipwalton.com
What No One Told You About Z-Index
1–10 of 100 posts
Re: What No One Told You About Z-Index
#2 > New stacking contexts can be formed [… w]hen an element has an
> opacity value less than 1.
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: > Since an element with opacity less than 1 is composited from a
> single offscreen image, content outside of it cannot be layered
> in z-order between pieces of content inside of it.
[1]: http://www.w3.org/TR/CSS2/visuren.html#z-index
[2]: http://www.w3.org/TR/2010/PR-css3-color-20101028/#transparen...Re: What No One Told You About Z-Index
#3So the results is the same, but the method is incorrect? does it matter? hmm
Re: What No One Told You About Z-Index
#4The key takeaway: > New stacking contexts can be formed [… w]hen an element has an > opacity value less than 1. 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: > Since an element with opacity less than 1 is composited from a > single offscreen image, content outside of it cannot be layered > in z…
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!Re: What No One Told You About Z-Index
#5But I got the same result by assigning z-index 2 and 3 to the other colors. So the results is the same, but the method is incorrect? does it matter? hmm http://codepen.io/anon/pen/DlyAv
Re: What No One Told You About Z-Index
#6But I got the same result by assigning z-index 2 and 3 to the other colors. So the results is the same, but the method is incorrect? does it matter? hmm http://codepen.io/anon/pen/DlyAv
Re: What No One Told You About Z-Index
#7But I got the same result by assigning z-index 2 and 3 to the other colors. So the results is the same, but the method is incorrect? does it matter? hmm http://codepen.io/anon/pen/DlyAv
Re: What No One Told You About Z-Index
#8But I got the same result by assigning z-index 2 and 3 to the other colors. So the results is the same, but the method is incorrect? does it matter? hmm http://codepen.io/anon/pen/DlyAv
Re: What No One Told You About Z-Index
#9But I got the same result by assigning z-index 2 and 3 to the other colors. So the results is the same, but the method is incorrect? does it matter? hmm http://codepen.io/anon/pen/DlyAv
Re: What No One Told You About Z-Index
#10But I got the same result by assigning z-index 2 and 3 to the other colors. So the results is the same, but the method is incorrect? does it matter? hmm http://codepen.io/anon/pen/DlyAv