PDA

View Full Version : Height of container on page w/ dynamic content



ramenraider
11-07-2011, 10:07 PM
I have my "container" which is basically the holder of all the page content. The container stops as soon as it hits php based section, even when i have overflow: visible;

#main_body
{
border-left:solid 10px #FFFFFF;
border-right:solid 10px #FFFFFF;
border-bottom:solid 10px #FFFFFF;
background:#FFFFFF;
margin:auto;
width:930px;
padding-bottom:40px;
overflow:visible;
}

The page has different things that show up depending on a variety of things. Is there any way to have the height change along with the changing page content?

There are floats on the page, but I have a <div style="clear:both;"></div> at the bottom

(i'd post code but it's pretty messy and long, I don't think anyone wants to go through it)

Excavator
11-07-2011, 11:34 PM
Hello ramenraider,
Typically it's overflow: auto; that does the trick. It's hard to know why your #main_body does not enclose it's contents without seeing the code. Could be anything from a lack of DocType to invalid code... See the links in my signature line for help with both of those issues.

Hoatzin
11-08-2011, 03:55 PM
usually it's a no go to have a width without a defined height.

#main_body
{
border-left:solid 10px #FFFFFF;
border-right:solid 10px #FFFFFF;
border-bottom:solid 10px #FFFFFF;
background:#FFFFFF;
margin:auto;
width:930px;
min-height:600px;
height:auto;
padding-bottom:40px;
overflow:visible;
}

here i have set a minumum height at 600 pixels so the "container" will always be at least 600 pixels height and will change if more content is added.