Tim Zappe wrote:

> I recently posted a problem where I had a div that wasn't stretching around 
> the two floated divs that were within a parent div.-snip-

> I was pointed to a solution to give the parent div a overflow attribute with 
> the values of auto, hidden, or scroll. I tried this solution and it worked, 
> but I do not understand why.-snip-

> Does anyone know exactly what is going on here?

Here are the relevant citations:

http://www.w3.org/TR/2004/CR-CSS21-20040225/visudet.html#root-height

"if the element has any floating descendants whose bottom margin 
 edge is below the bottom, then the height is increased to include 
 those edges."

Combine this with the rules for overflow:auto:

http://www.w3.org/TR/2004/CR-CSS21-20040225/visufx.html#x0

"The behavior of the 'auto' value is user agent-dependent, but should 
 cause a scrolling mechanism to be provided for overflowing boxes."

As I see it, a float that is inside a container can overflow that
container, so overflow:auto would cause such a float to create a 
scrollbar, unless there is no assigned height on the container.
If the container has height:auto then it is free to get taller
when non-floated content is tall.

So the overflow:auto rule can either create a scroll for the tall
float or add height to the container. Apparently the consensus is 
to enlarge the container rather than do the scrollbar thing.

Big John



-- 
Perennial student + Impractical joker + CSS junkie = Big John
<http://www.positioniseverything.net>


                
__________________________________ 
Discover Yahoo! 
Stay in touch with email, IM, photo sharing and more. Check it out! 
http://discover.yahoo.com/stayintouch.html
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to