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

[CSS21] Margin collapsing - clarify the transitivity

From: Anton Prowse <prowse@moonhenge.net>
Date: Sun, 04 Mar 2012 14:39:31 +0100
Message-ID: <4F537093.70009@moonhenge.net>
To: "www-style@w3.org" <www-style@w3.org>
8.3.1 says:

   # In CSS, the adjoining margins of two or more boxes (which might or
   # might not be siblings) can combine to form a single margin. Margins
   # that combine this way are said to collapse, and the resulting
   # combined margin is called a collapsed margin.
   #
   # Adjoining vertical margins collapse, except:
   #  [omitted cases]


   # A collapsed margin is considered adjoining to another margin if any
   # of its component margins is adjoining to that margin.
   #
   # Note. Adjoining margins can be generated by elements that are not
   # related as siblings or ancestors.


The recently-rewritten text made a clear distinction between adjointness 
and margin collapsing, employing the former as a tool to define the 
latter.  This was a good idea, but it doesn't quite achieve its goals: 
there still remains some vagueness about whether either concept is 
transitive.

Note there doesn't seem to be any particular advantage in making 
adjointness transitive, and the disadvantage is that it becomes a less 
useful tool for defining collapsing since it becomes too similar to 
collapsing.  (8.3.1 is a pretty hard section to word satisfactorily, so 
the more useful the tool, the better.)


To make it clearer that adjointness is non-transitive and collapsing is 
transitive, I propose the following.

Replace:

   # In CSS, the adjoining margins of two or more boxes (which might or
   # might not be siblings) can combine to form a single margin.

with:

   | In CSS, two or more adjoining margins can combine to form a single
   | margin.

This makes it clearer that there may be more than two component margins 
of a collapsed margin (as opposed to two or more boxes involved, which 
is actually not true).  The subsequent sentence then more clearly 
applies to any pair of component margins of a collapsed margin, thus 
making the language of "collapsing" transitive.

Note that the "might or might not be siblings" bit is unnecessary, since 
a quick glance at the definition of "adjoining" is enough to see that fact.

Remove:

   # A collapsed margin is considered adjoining to another margin if any
   # of its component margins is adjoining to that margin.

Firstly, to induce multiple collapsing there's no need to engineer a 
single margin to be adjoining to a collapsed margin, since multiple 
margins participating in a collapse is captured successfully by the 
first paragraph of 8.3.1 once the above change is applied.  (Note how 
that change is carefully worded so that multiple adjoining margins which 
collapse are not necessarily *pairwise* adjoining.)  Hence the sentence 
is unnecessary.

Secondly, it introduces confusion because it makes adjointness sound 
more like a transitive relation, even though it isn't one.

Thirdly, it makes collapsing sound like it is implemented as a 
cumulative operation producing ever-denser collapsed margins, whereas in 
fact there is only one collapsed margin.

Remove:

   # Note. Adjoining margins can be generated by elements that are not
   # related as siblings or ancestors.

This is only true in conjunction with the previous paragraph, which I 
propose removing.  The idea that the note is trying to convey is that 
two component margins of a collapsed margin could belong to elements 
which are neither siblings, nor parent-child (nor the same element, 
presumably!).  But again this is captured by the first paragraph of 8.3.1.


Any thoughts on the suggestion?


Cheers,
Anton Prowse
http://dev.moonhenge.net
Received on Sunday, 4 March 2012 13:40:00 GMT

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