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


I find the explanation of layered presentation in chapter 9.9 of the CSS 2.1 
draft confusing. Here's why:

1) "The stack level of the generated box in the current stacking context is 
the same as its parent's box."

Is there a typo here? I'd imagine a stack level can't be the same as a box. 
If a context really is a box, "the same as" is redundant.

2) "Each box belongs to one stacking context. Each box in a given stacking 
context has an integer stack level, which is its position on the z-axis 
relative to other boxes in the same stacking context."

What does it mean to belong to a stacking context? It's quite clear that 
each box that establishes a stacking context has in fact two stack levels: 
one in the "current" context and another in the context that it establishes.

3) "Each stacking context consists of the following stacking levels (from 
back to front):

1. the background and borders of the element forming the stacking context.
2. the stacking contexts of descendants with negative stack levels."

This concept of "stacking levels" is weird, because it's used together with 
"stack levels", that are something totally different. StackING levels seem 
to impose a super-structure on them. Appendix E uses the terms "stacking 
order" and "painting order" instead of stacking levels.

Let's presume that the stacking levels/order really determine the order in 
which the different boxes are painted. The order given seems to indicate 
that the background and borders of an element that establishes a stacking 
context are painted _underneath_ (behind) the element's descendants, even if 
the descendants have a lower stack level (< 0) than the element itself (0). 
On the other hand, "boxes with greater stack levels are always formatted in 
front of boxes with lower stack levels." This would be a contradiction.

4) "The root element forms the root stacking context."

Does the root element have a stack level of 0? Can other elements have 
negative levels and thus be behind the root element?

5) Do "establishing", "forming" and "generating" a stacking context mean the 
same thing? If not, the differences aren't clear. Moreover, why is it, that 
both boxes and elements are described as establishing contexts? It's not a 
big issue though, as the concepts of element and box are pretty much 
interchangeable here. What about "formatting", "painting" and "rendering", 
are they the same?

Thanks for bearing with me. I know I must be missing something here (like 
common sense), but I do hope that the CSS3 specification will be easier to 

Roger Olsson

FREE pop-up blocking with the new MSN Toolbar - get it now! 

Received on Wednesday, 4 October 2006 07:22:54 UTC