Re: [CSS 2.1] [section 9.5 Floats] Empty floated element with a set width but height:0

Gérard Talbot wrote:
> 
> Does an empty floated element with a set width occupy an horizontal space
> on a line?
> 
> Testcase:
> 
> http://www.gtalbot.org/BrowserBugsSection/css21testsuite/floats-107-gt.html
> 
> According to Ian Hickson, div#zero-height-first-float should occupy an
> horizontal space (6em) on the line... but all mainstream browsers (IE8,
> Firefox 3.6.8, Opera 10.60, Chrome 5.0, Safari 5.0, Konqueror 4.4.5) do
> not allocate an horizontal space to that div#zero-height-first-float .

(We're talking about zero-height floats, rather than empty floats.)

The following may be useful for comparison.

<div style="line-height:20px; width:200px">
	<div style="float:left; height:20px; width:100px"></div>
	text text text text text text text text text text text text text
</div>

Only one line box is shortened by the float; in particular, the second
is not shortened.  Is there really any difference between that and

<div style="line-height:20px; width:200px">
	<div style="float:left; height:0; width:100px"></div>
	text text text text text text text text text text text text text
</div>

in which browsers decide that no line box is shortened by the float?

It just boils down to what is regarded as being "next to" the float.
 From 9.5:

   # line boxes created next to the float are shortened to make room for
   # the margin box of the float

Cheers,
Anton Prowse
http://dev.moonhenge.net

Received on Friday, 30 July 2010 21:15:47 UTC