W3C home > Mailing lists > Public > www-style@w3.org > July 2010

Re: [CSS2.1] Clarifying 8.3.1 Collapsing Margins

From: L. David Baron <dbaron@dbaron.org>
Date: Wed, 28 Jul 2010 20:56:50 -0700
To: fantasai <fantasai.lists@inkedblade.net>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <20100729035650.GB16533@pickering.dbaron.org>
On Wednesday 2010-07-28 20:25 -0700, fantasai wrote:
> On 07/28/2010 08:01 PM, 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
> >
> >| In CSS, the adjoining margins of two or more boxes (which could be
> >| next to one another or nested) can combine to form a single margin.
> >| Margins that behave this way are called <dfn>collapsing margins</dfn>.
> >|
> >| Two margins are adjoining if and only if:
> >| * no non-empty content, padding or border areas; line boxes;
> >| or clearance separate them
> >| * both belong to normal-flow block-level boxes in the same block
> >| formatting context
> 
> Hm, need to add
>  | * if one belongs to a last in-flow child and the other belongs to
>  |   its parent, the parent's used height is not the result of a
>  |   specified height constraint (via 'height', 'max-height', or
>  |   'min-height').

I agree you need to add something to this effect.

However, what you propose adding here is a substantive change.  It
makes 'max-height' have an effect on margin collapsing, and also
significantly changes the way 'min-height' does.  I believe the
current definitions of those are, in at least some regards, written
quite carefully to avoid the spec having infinite loops or
unsatisfiable constraints.  (For example, I believe your rule
introduces an unsatisfiable constraint for some cases of elements
with max-height and a last child with a negative margin, and also
some cases of min-height and a last child with a positive margin.)
We had significant discussions of such issues at some point in the
past (possibly the Oslo F2F in August 2003, though likely not).

Also, the way you wrote it makes the definition of adjoining-ness
non-transitive.  It absolutely needs to be transitive.  In other
words, your new wording says that given:
  <div id="A" style="height: 50px">
    <div id="B"></div>
    <div id="C"></div>
  </div>
  <div id="D"></div>
that all pairs of margins between C and A are not adjoining, but 
that all pairs of margins between B and D are adjoining (when they
in fact should not be).  The constraint should instead be worded in
terms of being on the opposite sides of the gap (?) between the
bottom margin of such a last child and the bottom margin of its
parent.

I'd note that the *current* rule in the spec regarding 'min-height'
*also* violates transitivity of adjoining-ness, and I'm not entirely
sure what it meant to say (or whether it should be there at all).

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Thursday, 29 July 2010 03:57:25 GMT

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