views:

155

answers:

1

Hi everyone,

I would like to create a footer which is relative to the content (so not fixed), but fills the rest of the screen. So for example, on my larger monitor, the footer would start in the same place, but fill up 100px (for example). On a smaller monitor, it only needs to fill up 75px. I tried using 100%, but it causes the page to be really big and the user can scroll down and fill the entire screen with the footer. Is there a way to get it to be a bit more reasonable size, so that it just about fills the bottom of the screen? My current code is this:

.footer
{
    position:relative; //can't be fixed as content might overlap if extended    
    height:100%;
    width:100%; //fill the entire screen horizontally
    bottom:0px;
    margin-top:345px; //used to make sure content doesn't overlap
}

Thanks for any ideas

+1  A: 

I was struggling with something similar and the trick I found to solve it was to make sure to set body and html to min-height:100% as well as then have content and all other divs equal 100%.

html {
    min-height: 100%;
}
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}
#content {  
    min-height: 100%;
}
adamwstl