W3C home > Mailing lists > Public > www-style@w3.org > August 2005

Re: 'clear' and clearance

From: Ian Hickson <ian@hixie.ch>
Date: Sat, 27 Aug 2005 20:38:04 +0000 (UTC)
To: Staffan Mhln <staffan.mahlen@comhem.se>
Cc: www-style@w3.org
Message-ID: <Pine.LNX.4.62.0508272036210.27381@dhalsim.dreamhost.com>
On Wed, 10 Aug 2005, Staffan Mhln 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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:20 UTC