Html & css

garretblake

New Member
Hello guys. I have a doubt about some html and css issues. I want to make a div that have no height.that can grow in height along with the divs that are inside this first div. I cant do this because when I put the divs that are inside, to be side by side I had in the CSS "float left" and "clear left". doing this, the main div don't grow with the divs inside. It's hard to explain, so I made a little graphic to explain it.

layoutv.jpg


I hope someone can help me on this. Thanks and Cheers
 

PixelPusher

Super Moderator
Staff member
No worries Garret, it makes total sense. Your problem is that floated items dont adhere to the normal flow of a document just like a fixed or absolute positioned element. To remedy this (for floats) you want to set the css style "overflow" to "hidden". You css would look like this:

Code:
div.container {
overflow:hidden;
/* all other styles for the containing div */
}
 
Last edited:

PixelPusher

Super Moderator
Staff member
Right. The problem there is that you are using an empty element/tag to solve your issue. While this works, it is not semantically correct. The proper solution is to use the overflow style.
 
Top