Re: z-index

Thanks for answering,

> > I thought that the z-index specified in what order to
> > draw sibling elements, but apparently it doesn't?
>
> It specifies the order in which to draw the elements in a given stacking
> context.

And a new stacking context is created on the root and when a positioned
element has something else than auto? (Just to make sure I've read the spec
correctly)

But in my example, if the <em> had z-index: 1, then it would be correct to
overlap the second <p> (and everything else on the *entire* page that had
z-index below 1?)

So there would be two stacking contexts on the page, one for the root
element, and one for the <em>?

If so, then I'll have to rethink the way I draw things to the screen. I
currently have a tree/hierarchy of boxes, which I draw one after the other,
recursively. Introducing z-index, I should keep a tree/hierachy of the
stacking levels also, where each stacking context keeps a list of the boxes
that belong to that stacking-context and draw recursively the
stacking-contexts ? Would something like that result in the correct
rendering?

And the fact that other browers do it incorrectly, is that because they
always increase the stack level of absolutely positioned elements? (even if
auto is specified for z-index)

> In your case, everything has z-index auto, so per CSS2 things should be
> drawn in document order, with the second <p> being on top of the <em>
> which is on top of the first <p>.  No existing implementation actually
> does it that way, as you noted.
>
> Last I heard, the WG was going to attempt address this issue (possibly
> by making an erratum to the z-index section).

By this you mean, change the spec to accomodate browsers?

Thanks again,

--
Sigurd Lerstad

Received on Thursday, 18 July 2002 23:06:27 UTC