Click to See Complete Forum and Search --> : Changing div heights with dynamic content


padams
01-02-2009, 02:33 AM
My page is divided into several divs, a banner, a nav bar, and a content area, all inside a div called container. The banner and nav divs are of a fixed height. The content for the content div comes from a mySQL database using PHP, so the height varies depending on what page it is. There is a background colour so it looks a bit silly when the div doesn't stretch to fit the content. I've tried setting a min-height but this also looks odd when there is little content on a page.

I thought that the div would stretch automatically since the dynamic content is being rendered as HTML, but it doesn't. Have looked around a lot and can't find any solutions. Anyone have any ideas?

Thanks in advance.

ryanbutler
01-03-2009, 03:55 PM
Using min-height is a bad idea for reasons you already mentioned. You have the right idea behind using the container DIV, but without a page example, it's hard to diagnose what you need to do.

padams
01-05-2009, 01:16 AM
Website is at touch.school.nz if you want to have a look. The min height is still set as that covers all pages, but as you will see it makes the homepage a bit longer than necessary!

The CSS for the content class is:
.content {
background-image: url(images/steel.jpg);
width: 960px;
background-color: #000000;
background-repeat: no-repeat;
padding-top: 5px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
text-align: left;
min-height:800px;
}
Don't think there's anything there other than the min-height that would cause problems, but please let me know if anyone spots anything.

Would the fact that I create the recordset to be displayed at the beginning of the page cause what is happening? Rather than doing it after opening the content div.