floating divs puts outside of parent div

They have: 426 posts

Joined: Feb 2005

Ok so i have a little problem. If i put a div inside another then the child div will make the parent div expand once the child div has more content inside of it(gets bigger). However, whenever i try to float the child div to the left or right it then gets forces outside the div (seems to change the z-index) and is no longer making the parent div larger (the parent div acts as if nothing is inside of it).

What am i doing wrong?

He has: 629 posts

Joined: May 2007

Try floating the outer container. If this is impractical, use this declaration in the CSS for the outer DIV:

{overflow: auto;}'

You may need to add a dimension to the container as well. "width:100%;" should work without upsetting things.

These establish a new "block formatting context." See here:
http://css-discuss.incutio.com/?page=FormattingContexts

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

They have: 426 posts

Joined: Feb 2005

sorry i figured it out, like a pratt i had a fixed height on it!! so course it was forced outside the div because the div could not enlarge.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.