W3C home > Mailing lists > Public > www-style@w3.org > July 2010

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

From: Gérard Talbot <www-style@gtalbot.org>
Date: Fri, 30 Jul 2010 16:49:09 -0700
Message-ID: <e2ff1dfebfe3180ee9a03e7bdaf087fc.squirrel@cp3.shieldhost.com>
To: www-style@w3.org
Cc: "Anton Prowse" <prowse@moonhenge.net>

Le Ven 30 juillet 2010 14:14, Anton Prowse a écrit :
> 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.)

Anton, as you say, zero-height float is more on target of the matter.

> 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


Your post answers my question. I think the line box just moves under,
below the zero height float.

Since it is a zero height box and it occupies no height, there is no need
to shorten the line box.

I have uploaded your examples for those who would wish to examine them:


Thank you for your reply and best regards, Gérard
CSS 2.1 Test suite beta 2 (July 27th 2010)

Contributions to CSS 2.1 test suite

Web authors' contributions to CSS 2.1 test suite
Received on Friday, 30 July 2010 23:49:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:48 UTC