W3C home > Mailing lists > Public > www-style@w3.org > October 2006

Re: [CSS21] Layered presentation, z-index hard to comprehend

From: Master Pumpkin <master_pumpkin_@hotmail.com>
Date: Thu, 05 Oct 2006 18:33:37 +0300
Message-ID: <BAY21-F53B4BD0B1D7E07026691BA7120@phx.gbl>
To: www-style@w3.org

>>Thanks, I read Paolo Lombardi's tutorial but unfortunately it didn't touch 
>>on the subject of negative stack levels and the contradiction in the 
>>specs. Firefox (, 2.0 RC1)
>I suggest testing a nightly build based on Gecko 1.9.  A lot of the z-index 
>bugs that Gecko 1.8 (Firefox 1.5 and 2) had got fixed in the year since 1.8 

I tested a Firefox nightly and indeed, it behaves like other browsers now. 
My conclusions follow.

This is true:
"Boxes with greater stack levels are always formatted in front of boxes with 
lower stack levels."

But this is false:
"The box also establishes a local stacking context in which its stack level 
is '0'."

Although the box is involved in its own stacking context, it does not have a 
stack level like its descendants may have. Instead, the borders, background 
and contents are stacked according to the complex rules laid out in Appendix 
E, dispersed among descendants with different, specified stack levels. I had 
a feeling it would have been too much to ask to have an intuitive and 
logical stacking system. ;-)

There are probably good reasons for this order - I hope it wasn't created 
because of IE's quirky behaviour - but one consequence is that placing a 
child element behind its parent is impossible. A workaround is to create a 
holding element that establishes the context and then place the two elements 
inside as siblings. The holder div can be shrink-wrapped around one child 
and the size and position of the other can be derived from the holder.

Many thanks,
Roger Olsson

Share your special moments by uploading 500 photos per month to Windows Live 
Received on Thursday, 5 October 2006 15:33:51 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:26 UTC