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

Re: [CSS21] Negative clearance

From: fantasai <fantasai.lists@inkedblade.net>
Date: Mon, 29 Dec 2008 13:13:23 -0800
Message-ID: <49593D73.7090508@inkedblade.net>
To: Anton Prowse <prowse@moonhenge.net>
CC: "www-style@w3.org" <www-style@w3.org>

Anton Prowse wrote:
> 
>  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?

There's a note where clearance is defined
   http://www.w3.org/TR/CSS21/visuren.html#flow-control
that says that clearance can be negative.

That clearance causes margins to not collapse is specified in 8.3.1:
   http://www.w3.org/TR/CSS21/box.html#collapsing-margins

Do you have a suggestion on how to make that 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?

Margins are transparent. I would expect them to be transparent wrt
events as well as to color.

> 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?

dbaron would probably have to answer that. I wouldn't know.

~fantasai
Received on Monday, 29 December 2008 23:29:01 GMT

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