W3C home > Mailing lists > Public > www-style@w3.org > May 2009

Re: [CSS21] Clearance paradox

From: fantasai <fantasai.lists@inkedblade.net>
Date: Wed, 20 May 2009 08:01:36 -0700
Message-ID: <4A141B50.3040200@inkedblade.net>
To: Anton Prowse <prowse@moonhenge.net>
CC: "www-style@w3.org" <www-style@w3.org>
Anton Prowse wrote:
> Hi,
> 
> I think CSS2.1 contains a paradox as regards clearance.
> ... 
> When H = M2 (which happens to be what the diagram actually shows!) we
> have a problem:  if clearance is zero then margins collapse and so
> clearance is non-zero; but if clearance is non-zero then margins don't
> collapse and the clearance needed is zero.

Anton Prowse wrote on 2 Apr 2009:

> The least disruptive solution to the problem discussed therein is to say
> that an element can still be said to have clearance even if that
> clearance is zero.  In other words, clearance is a property that
> elements may possess in addition to being a quantity which is applied.
> This makes the whole thing hold together conceptually, and required no
> conceptual changes to the 'clear' property.  To put it another way, the
> specification currently incorrectly equates zero clearance with no
> clearance, yet the two concepts would be different under the solution
> above.  Of course, this solution requires some editorial changes to the
> text of 9.5.2 The 'clear' property
> (http://www.w3.org/TR/CSS21/visuren.html#propdef-clear) and 8.3.1
> Collapsing margins
> (http://www.w3.org/TR/CSS21/box.html#collapsing-margins) where clearance
> is sometimes regarded as solely a quantity through the implication that
> zero clearance implies /no/ clearance.
> 
> For example, in 9.5.2 the sentence,
> 
>    "Clearance is introduced as spacing above the margin-top of an
>     element. It is used to push the element vertically (typically
>     downward), past the float."
> 
> would need to state that clearance is actually a element property and
> its effect is to prohibit margin collapsing and /then/ introduce spacing
> (positive, /zero/ or negative).  Several other sentences in that section
> would also need rewriting.
> 
> Equally, in 8.3.1 the sentence,
> 
>    "no non-empty content, padding or border areas or clearance separate
>     them"
> 
> would need to change, but it is tricky to see how to do that elegantly. :-(
> 
> Also in that section, there are a couple of uses of the phrase,
> 
>    "An element that has had clearance applied to it"
> 
> which already sounds awkward anyway, and should probably be written,
> 
>    "An element that has clearance".
> 

Proposed changes:

9.5.2 Controlling flow next to floats: the 'clear' property

Change
   # Clearance is introduced as spacing above the margin-top of an element.
   # It is used to push the element vertically (typically downward), past
   # the float.
to
   | Values other than 'none' introduce clearance as spacing above the
   | margin-top of an element. Clearance inhibits margin collapsing and
   | is used to push the element vertically past the float.
and shift to after value definitions.

Change
   # The clearance of the generated box is set to the amount necessary to
   # place the top border edge below the bottom outer edge of any
to
   | Requires that the top border edge of the box be below the bottom
   | outer edge of any
x3

Change
   # then its clearance must be set to the greater of:
to
   | then clearance is introduced and must be set to the greater of:

Change
   # The clearance can be negative.
to
   | The clearance can be negative or zero.

8.3.1 Collapsing margins

Change
   # An element that has had clearance applied to it never collapses
to
   | An element that has clearance never collapses

Change
   # When an element's own margins collapse, and that element has had
   # clearance applied to it
to
   | When an element's own margins collapse, and that element has clearance

Would these changes address the issue?

~fantasai
Received on Wednesday, 20 May 2009 15:02:22 GMT

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