I believe that it is because floated elements are removed from the document
flow just like absolutely positioned elements are. So the rest of the
elements on the page, including the containing element, literally can't see
the floated element. If they can't see it, then they can't accommodate its
height, width, or any other property of it.

That's how I've always understood it, anyway. I'm sure someone will correct
me if I'm wrong. :)

Cheers,

Seona.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of John Horner
> Sent: Friday, 11 February 2005 10:17 AM
> To: wsg@webstandardsgroup.org
> Subject: [WSG] Why DO floats not stretch their containers?
> 
> 
> This is more of a philosophical question than a technical question, 
> but here's the background. As we probably all know:
> 
>   * floated elements too big for the enclosing element "spill out"
>   * except on IE, where they stretch the enclosing element
> 
> that's a bit simplified, but essentially correct, right?
> 
> For instance, with this code:
> 
> <div style="width:300px;height:100px;border:1px solid black;">
>    DIV A
>      <div style="width:100px;height:300px;border:1px solid 
> red;float:left;">
>        DIV B
>      </div>
> </div>
> 
> DIV B will overlap DIV A and continue down the page on its own unless 
> you're in IE in which case A will stretch.
> 
> My question is, *why* is the correct behaviour the first one? It 
> takes a lot of people by surprise and they often see what IE does as 
> the natural and obvious thing to do.
> 
> I'm not trying to start a flame war, I really want to know!
> 
> I looked at my copy of the O'Reilly Definitive Guide by Eric Meyer 
> and it just says that it's the correct behaviour, although some 
> browsers don't respect it. It doesn't offer a rationale.
> 
> ------------------------------------------------------------
>                 "Have You Validated Your Code?"
> John Horner                            (+612 / 02) 9333 3488
> Senior Developer, ABC Online          http://www.abc.net.au/
> ------------------------------------------------------------
> ******************************************************
> The discussion list for  http://webstandardsgroup.org/
> 
>  See http://webstandardsgroup.org/mail/guidelines.cfm
>  for some hints on posting to the list & getting help
> ******************************************************
> 
> 

__________________________________________________________________
<< ella for Spam Control >> has removed Spam messages and set aside Later
for me
You can use it too - and it's FREE!  http://www.ellaforspam.com

<<attachment: winmail.dat>>

Reply via email to