Reputation: 831
i'm extremely frustrated right now. I can't figure out why my container won't extend to the bottom of the page. it reaches the bottom of the visible window, but if you scroll down past that, then the background ends.
my basic structure looks something like this...
<div id='container'>
<div id='content'>
/*Some Content here but all divs opened here are closed. (Title Bar, Nav, etc)
<div id='mainTableContainer'>
/*This is where a bulk of the code is. A table is generated in PHP and it
gets fairly lengthy.
</div>
</div>
</div>
So that's basically the HTML. I can't for the life of my figure out why #container won't extend to the bottom of the page!
And the CSS
html{
height:100%;
}
body {
font: 100%/1.4 "Museo-sans", Verdana, Arial, Helvetica, sans-serif;
background: #ccc;
margin: 0;
padding: 0;
color: #000;
height:100%;
background-image:url(images/bg.png);
}
.container {
width: 960px;
background: #FFF;
height:100%;
margin: 0 auto;
border-left-style:dashed;
border-right-style:dashed;
border-width:1px;
border-color:#bf0000;
}
.content {
height:100%;
padding: 10px 0;
}
#mainTableContainer{
margin:0px auto;
width:90%;
height:100%;
text-align:center;
}
I tried a lot of the tips I found on this site, but nothing was helping. I don't think anything is floated. I tried setting all the heights to 100%, I tried setting a min width... I can't figure it out!!
EDIT: OK I MADE A JSFILDDLE So if you shrink the size of the display second in jsfiddle to smaller than the table, and then refresh it, you'll see that the background doesn't go all the way down, and the table is left 'floating' in the air. http://jsfiddle.net/LGM3y/1/
Upvotes: 4
Views: 13232
Reputation: 31
It seems to work fine (if I understand exactly what you're asking) if you remove the
html {height: 100%;}
The container fills the space ..
Upvotes: 1
Reputation: 102
One trick I use for this on <div>
's (which has mixed results in IE) is to specifically set display: block
in the CSS rules for the container that you want to extend.
Example:
#container {
display: block;
height: 100%;
}
Upvotes: 0
Reputation: 2307
You're trying to select a class, but container is an ID, so you need:
#container
instead of
.container
If that doesn't fix it try setting the background CSS on the HTML tag instead of the container.
html{
height:100%;
background:#ccc url(images/bg.png);
}
etc
Upvotes: 4