[CSS21] Negative clearance

 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 UTC