W3C home > Mailing lists > Public > www-style@w3.org > March 2011

RE: [CSS2.1] Clarifying 8.3.1 Collapsing Margins

From: Arron Eicholz <Arron.Eicholz@microsoft.com>
Date: Mon, 14 Mar 2011 20:48:08 +0000
To: "L. David Baron" <dbaron@dbaron.org>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <07349ECFC3608F48BC3B10459913E70B12CFD3A2@TK5EX14MBXC132.redmond.corp.microsoft.com>
On Tuesday, September 14, 2010 4:45 PM L. David Baron wrote:
> On Thursday 2010-08-19 11:36 -0700, fantasai wrote:
> > This is for CSS2.1 Issue 159
> >   http://wiki.csswg.org/spec/css2.1#issue-159
> > triggered by this email
> >   http://lists.w3.org/Archives/Public/www-style/2010Feb/0015.html
> >
> > This is version 3.
> >
> >  | In CSS, the adjoining margins of two or more boxes (which could be
> > | siblings or nested) can combine to form a single margin.
> 
> The "(which could be siblings or nested)" seems too limiting; as the note
> below says, they could be in many other configurations, but this could be
> interpreted to restrict them to only those configurations.  I'd suggest
> dropping the parenthetical.
> 
> >  | Margins that combine this way are said to <dfn>collapse</dfn>, and
> > | the resulting combined margin is called a <dfn>collapsed margin</dfn>.
> >  |
> >  | Adjoining vertical margins collapse, except:
> >  |   * Margins of the root element's box do not collapse.
> >  |   * If the top and bottom margins of an element with clearance are
> >  |     adjoining, its margins collapse with the adjoining margins of
> >  |     following siblings but that resulting margin does not collapse
> >  |     with the bottom margin of the parent block.
> >  | Horizontal margins never collapse.
> >  |
> >  | Two margins are adjoining if and only if:
> >  |   * both belong to normal-flow block-level boxes that participate
> >  |     in the same block formatting context
> 
> Since we don't actually define "participate in" a block formatting context, I
> think it's important to also say here that neither of the boxes is the box that
> establishes the block formatting context.
> 
> >  |   * no line boxes, no clearance, and no non-empty padding or border
> >  |     areas separate them
> >  |   * both belong to vertically-adjacent box edges, i.e. form one of
> >  |     the following pairs:
> >  |       - top margin of a box and top margin of its first in-flow child
> >  |       - bottom margin of box and top margin of its immediately
> >  |         following in-flow sibling
> 
> I'd suggest dropping "immediately".  I think the immediacy that's required is
> covered by the point before (no line boxes, no clearance, etc.), and this
> could be interpreted to break margin collapsing in cases where it should not
> be broken (floats, collapsed whitespace).
> 
> In fact, it might need clarification to say that a "following in-flow sibling" could
> be a later sibling if intervening siblings are out-of-flow.
> 
> >  |       - bottom margin of a last in-flow child and bottom margin
> >  |         of its parent if the parent has 'auto' height
> 
> I think this should specifically refer to "computed height" rather than just
> "height".
> 
> I think this also needs to say that 'min-height' is nonzero, but that's a fix to a
> transitivity bug existing in the current spec.
> 
> >  |       - top and bottom margins of a box with zero used height and
> >  |         no in-flow children
> 
> As I mentioned in the telecon, changing this to refer to "used height" is a
> substantive change that, as we discussed, appears to disagree with
> implementations.  This should be changed back to saying that the computed
> 'min-height' is '0' and computed 'height'
> is '0' or 'auto'.
> 
> >  | A collapsed margin is considered adjoining to another margin if  |
> > any of its component margins is adjoining to that margin.
> 
> > [...]
> 
> >  |   * The top margin of an in-flow block element collapses with
> >  |     its first in-flow block-level child's top margin if the
> >  |     element has no top border, no top padding, and the child has
> >  |     no clearance.
> >  |   * The bottom margin of an in-flow block element with a
> >  |     'height' of 'auto' collapses with its last in-flow block-level
> >  |     child's bottom margin if the element has no bottom padding and
> >  |     no bottom border and the child's bottom margin does not collapse
> >  |     with a top margin that has clearance.
> 
> These aren't quite correct in the terminology of CSS, since it doesn't consider
> text to be siblings.  So this is saying that the margins of the div and the p
> collapse in:
>   <div> text <p>text</p> text</div>
> (This is an existing problem in the text.)
> 
> The second one also needs to be adjusted to match the height changes
> above.  The existing text was part of the area where the current spec breaks
> transitivity of adjoining-ness.
> 

Thank you for your feedback. The CSSWG resolved not to make changes  pertaining to the transitivity of adjoining-ness within the margin collapsing rules in the CSS 2.1 specification[1]. We will be reevaluating this issue for errata and future versions of CSS. 

Please respond before 18 March, 2011 if you do not accept the current resolution.

[1] http://w3.org/TR/CSS
Received on Monday, 14 March 2011 20:48:44 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:38 GMT