Re: 'clear' and clearance

On Wed, 10 Aug 2005, Staffan Måhlén wrote:
>
> Is "clearance" when a clear actually takes effect or is it that the 
> 'clear' property is defined to left, right or both?

Clearance is the distance added (or removed, for negative clearance) 
between two margins in order to force a block to clear. See 9.5.2.

> In other words, should the margins in the following case collapse or 
> not?
> 
> <div style="margin-bottom: 0.5em">-</div>
> <div style="margin-top: 0.5em; clear: both">-</div>

Yes, 'clear' has no effect here since there is no float.


> compared to:
> 
> <div>-</div>
> <div style="float: right; width: 0.5em; height: 0.5em">&nbsp;</div>
> <div style="margin-top: 0.5em; clear: both">-</div>

Clearance is not needed here (the 0.5em margin-top clears the float on its 
own with no help from 'clear') so the margins collapse here too (not that 
you could tell the difference if they didn't in this case).

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Saturday, 27 August 2005 20:38:14 UTC