W3C home > Mailing lists > Public > www-style@w3.org > January 2005

Re: Question on collapsing margins and block reflow context roots

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 28 Jan 2005 10:34:30 -0600
Message-ID: <41FA6996.6040605@mit.edu>
To: Ian Hickson <ian@hixie.ch>
CC: www-style@w3.org

Ian Hickson wrote:
> You can get very close with real CSS:
> 
>    http://junkyard.damowmow.com/173
> 
> ...with minimal amounts of extra-CSS, I don't see the problem.

The minimal extra CSS for that case is something like "fieldset border doesn't 
paint behind the legend element" or something and is very hard to pin down if 
people change the position on the legend or its offsets (as in, what should the 
behavior really be, then?).

> It shouldn't be a block formatting context root.

OK.  Forget that <fieldsets> are involved.  Should the margins of a block 
formatting context root collapse with its children, in general?  Per the current 
spec, the answer sounds like "no", but this is nowhere clearly stated; instead 
enumerated lists of things that do and don't collapse are given.

In fact, the general section on what doesn't collapse could be summed up as follows:

1)  Margins of out-of-flow elements do not collapse at all.
2)  Margins of block formatting context roots do not collapse with their
     children.

This would cover the following existing rules:

# Vertical margins between a floated box and any other box do not collapse (not 
even between a float and its in-flow children).
# Vertical margins of elements with 'overflow' other than 'visible' do not 
collapse with their in-flow children.
# Margins of absolutely positioned boxes do not collapse (not even with their 
in-flow children).

(You still need the rule for inline-blocks, since they are in-flow).

Is there a reason not to make this change?  It would make this section much more 
future-compatible and much more extension-compatible.

-Boris

  It should act exactly

> like a block for most purposes, so margin-wise it should collapse with 
> siblings as per normal. It shouldn't grow to fit floats. Its children
> should collapse margins normally, and if the border and padding of the 
> fieldset is removed, they should collapse out as per normal as well.
> 
Received on Friday, 28 January 2005 16:34:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:35 GMT