W3C home > Mailing lists > Public > www-style@w3.org > November 2008

[CSS21] Negative clearance

From: Anton Prowse <prowse@moonhenge.net>
Date: Sun, 23 Nov 2008 12:53:38 +0100
Message-ID: <49294442.8080102@moonhenge.net>
To: "www-style@w3.org" <www-style@w3.org>

 From CSS21:

Clearance is introduced as spacing above the margin-top of an element. 
[...] Computing the clearance of an element on which 'clear' is set is 
done by first determining the hypothetical position of the element's top 
border edge within its parent block. This position is determined after 
the top margin of the element has been collapsed with previous adjacent 
margins (including the top margin of the parent block).  If this 
hypothetical position of the element's top border edge is not past the 
relevant floats, then its clearance must be set to the greater of:
    1. The amount necessary to place the border edge of the block even 
with the bottom outer edge of the lowest float that is to be cleared.
    2. [...]

Firstly, it is not clear from a naive reading of expression (1) above 
that the amount described can be a negative quantity (and hence that 
clearance itself can be negative); only when the assumption is made (as 
affirmed in [1]) that the presence of non-zero clearance on an element 
prohibits margin-collapsing of that element's margin top with all 
non-descendant elements does the spec make sense to me.  If this is the 
correct reading, could this assumption not be made clearer?

Secondly, whilst the presence of negative clearing results in a 
rendering in which the margin-top of the clear appears to disappear[1], 
the implication in the spec is that it doesn't really disappear but that 
instead there is "negative spacing" above the margin top.  To me the 
result seems rather like "position: relative; top: 
<negative-clearance>".  Yet take for example [2];  if the margin-top of 
50px is "still there", why doesn't it overlay the first div, thus 
covering the hyperlink and making it unclickable?

Thirdly, I understand from [1] that clearance was originally implemented 
as a change in margin-top.  Superficially this seems intuitive, so 
there must be some tricky edge-cases which expose problems with this 
implementation.  Would somebody be able to summarize these for me or 
point me to a description?

Cheers,
Anton

[1] http://dbaron.org/log/2007-03#e20070329a
[2] 
http://dev.moonhenge.net/css21/spec/clearance/test-cases/negative-clearance.html
Received on Sunday, 23 November 2008 11:54:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:17 GMT