Previous Message
Next Message

Re: [css-d] escaping margins?

Sent by Scott Sauyet on 20 June 2002 12:12


>>  "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 important word here is 'adjoining'. This seems to exclude nested
> boxes.

I don't think it does.  If it read "The vertical margins of two or more
adjoining block boxes..." I would agree.  In this case, the margins are
in fact adjoining.


>        I wonder if the <p> margin will 'escape' thru more than one
> nested div top edge. (?)

It does.


> No matter how it's 'supposed' to work, it's still a design headache,
> and a useful demo. Thanks Joe!


I hope it didn't sound as though I were demeaning Joe's demo.  It is
certainly a design headache.  I was responding to this from his original
message:

>>> So, my question is, is this something everyone knew?  Is this some
>>> aspect of the box model I have totally missed?  Or is it a bona fide
>>> bug?

I don't think this is a bug, just an unfortunate artifact of a careful
reading of the specs.


> Note to Joe: try applying different rules (background/padding/margin,
> etc.) to the various elements. Could be that something will 'kill'
> this bug. Worth a shot. :]

I think the simplest thing, if it doesn't interfere with your design, is
to add one pixel of top and bottom padding to the zero-margin container.
Something else could be worked out with :first-child and :last-child, but
it would be more cumbersome, and would need some IE hacks.

  -- Scott
Previous Message
Next Message

Message thread: