Reputation: 7688
So I am trying to code the footer of my web app of it occupies the rest of the body's height.
Picture: http://img1.uploadscreenshot.com/images/orig/3/8906151296-orig.png
Notice the light area beneath the dark area, the dark area should occupy all of it.
Some of my html code:
<body>
....
<footer>
<hr>
<ul id="footerContainer">
<li class="right">
<ul>
<li>
<a href="" class="family-filter">Filtro Fami....</a>
</li>
</ul>
</li>
</ul>
</footer>
<script>...</script>
</body></html>
CSS:
....
#footerContainer {width: 90%; min-width: 525px; margin: 0 auto; position: relative;}
....
footer hr{ border: 0; height: 30px; background: url('../imgs/footer-top.png') repeat-x scroll; }
footer {
background: url('../imgs/footer-bg.png') repeat scroll bottom;
height: 100%;
display: block;
margin: 0 auto;
padding: 0;
overflow: auto;
}
#footerContainer {margin: 0 auto; position: relative;}
#footerContainer li { display: inline;}
#footerContainer li .right {float: right;}
#footerContainer li a {}
Any suggestions?
Update1:
This is what happens: http://img1.uploadscreenshot.com/images/orig/3/8906391235-orig.png when I set
html,body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
Update2:
http://awesomescreenshot.com/0382hf1ff
Zoom out and in at this page: line25.com/wp-content/uploads/2010/blog-design-coded/demo/… and check the footer area, that's how I need it work on my layout.
Upvotes: 0
Views: 3007
Reputation: 3262
Demo: JsFiddle
Giving an element height: 100%
means that it occupies 100% of the closest parent that has
height defined. In this case you don't know the footers height, because the height of the content is variable.
I don't know the rest of your html structure, but you could give the body
a white background-color and the content div dark grey.
Upvotes: 1
Reputation: 11645
The best way to do this is set the background-color of the html
and body
elements to be that of your footer. Then set the background-color of your content area to the lighter gray color.
html,body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-color: black;
}
#content {
background-color: silver;
}
Upvotes: 0
Reputation: 21044
There is a very useful demo of 100% height here:
This could be tweaked to fit your requirements.
Upvotes: 2