Previous Message
Next Message

Re: [css-d] escaping margins?

Sent by Scott Sauyet on 19 June 2002 17:05


> The other day, I noticed that Mozilla allowed the margins of a p tag
> that was the first child of a div to escape from the p and affect the
> div instead. [ ... ] Is this some aspect of the box model I have
> totally missed?  Or is it a bona fide bug?

Maybe I misunderstand the spec, but it seems to me that this is what
would likely happen from the collapsing vertical margins described
here: http://www.w3.org/TR/REC-CSS2/box.html#collapsing-margins.

    "Two or more adjoining vertical margins of block boxes in the
    normal flow collapse. The resulting margin width is the maximum of
    the adjoining margin widths."

The example on the W3C site only points out the collapsing of the
bottom margin of one block element and the top margin of the following
one, but I would guess that it applies equally to nested boxes.  This
would mean that the top margin of the div and the top margin of the
first paragraph inside the div would combine into a single margin.
The question of which block "owns" the combined margin according to
the spec is not clear to me, but I would probably make the same
assumption that Moz, Opera, and Microsoft all did, that the this
combined margin applies to the outer block.

Am I making any sense?

  -- Scott
Previous Message
Next Message

Message thread: