Re: [CSS2.1] Clarifying 8.3.1 Collapsing Margins

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.

-David

[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