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 21:07:51 -0700
To: fantasai <fantasai.lists@inkedblade.net>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <20100729040751.GA16701@pickering.dbaron.org>
On Wednesday 2010-07-28 20:56 -0700, L. David Baron wrote:
> 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).

One further note on transitivity [1]:  I've often thought that
collapsing margins are easier to explain using a relation that's not
transitive.  In other words, we could define adjoining as a
nontransitive relation such that:
 * the bottom margin of an element and the top margin of its next
   sibling are adjoining when ...
 * the top and bottom margins of an element are adjoining when ...
 * the top margin of an element and the top margin of its first
   in-flow child are adjoining when ...
 * the bottom margin of an element's last in-flow child and the
   element's bottom margin are adjoining when ...
and then say that two margins A and B collapse when there is some
sequence of margins beginning with A and ending with B such that
each pair of adjacent margins in the sequence are adjoining.


[1] http://en.wikipedia.org/wiki/Transitive_relation

L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Thursday, 29 July 2010 04:08:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:37 UTC