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

Re: [CSS21] 9.5.2 Effect of adjacent top margin of first in-flow child on clearance

From: Anton Prowse <prowse@moonhenge.net>
Date: Mon, 25 Jan 2010 18:06:46 +0100
Message-ID: <4B5DCFA6.60305@moonhenge.net>
To: www-style <www-style@w3.org>
Bruno Fassino wrote:
> On Sun, Jan 24, 2010 at 5:37 PM, Anton Prowse <prowse@moonhenge.net> wrote:
> 
>> the "easyclearing" technique whereby
>> div:after {
>>    content: "";
>>    display: block;
>>    clear: both;
>> }
>> causes the div to expand to enclose its floated children, even though
>> the generated content is empty)
> 
> 
> There are other cases when an
> 'empty' clear is not sufficient to make its parent to enclose floats
> (because no clearance is necessary), for example:
> 
> <div style="background:lime">
>  <div style="float:left; width:100px; height: 100px; background:blue"></div>
>  <div style="height: 50px; margin-bottom: 50px"></div>
>  <div style="clear: left"></div>
> </div>
> 
> (online here http://www.brunildo.org/test/margin-collapse-clear-7.html)
> 
> So I think easyclearing is always better applied with non empty
> generated content and then height:0, visibility:hidden

Agreed, I hadn't thought about that sort of situation.  Your point is 
very relevant to the easyclearing debate (as well as to the current 
discussion).

[Strictly, in order to avoid this kind of situation, the generated 
content in the easyclearing technique needs to be more that just 
non-empty: it cannot consist merely of whitespace which collapses to 
nothing.]

Cheers,
Anton Prowse
http://dev.moonhenge.net
Received on Monday, 25 January 2010 17:07:52 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:23 GMT