Reputation: 35905
I'm trying to create a very simple page that contains a container, a header, a left column and a footer:
<containter>
<header />
<content />
<leftBar />
<footer />
</containter>
I want to use the 100% of the height, as I can do with the width, but I simply dont get it work.At his moment I'm using
min-height, but how could I use the
height:100%` ? What I like is that the footer is always visible, and you scroll the content.
body
{
font-family: Verdana;
font-size: 0.8em;
background-color:#f1f1f1;
}
#container {
border:solid 2px Black;
position:absolute;
left:10%;
width:80%;
margin:auto;
}
#header {
height:20px;
background: #DDDDDD;
}
#leftBar {
width: 20%;
background: #669966;
min-height:600px;
postion:absolute;
top:20px;
bottom:20px;
}
#content {
float:right;
background-color: #cdcde6;
position:absolute;
left:20%;
right:0px;
bottom:20px;
top:20px;
padding:5px;
}
#footer {
position:absolute;
height:20px;
}
Upvotes: 4
Views: 2745
Reputation: 2548
I've actually just fixed a similar problem myself this evening, and the following link provided the perfect solution:
http://ryanfait.com/resources/footer-stick-to-bottom-of-page/
Hope it helps.
Upvotes: 1
Reputation: 401
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<style>
html, body { margin: 0 auto; height: 100%; }
#container { height: 100%; width: 80%; background: #e0e0e0; margin: 0 auto;}
</style>
</head>
<body>
<div id="container">
</div>
</body>
</html>
Trick is to expand html,body to 100%
Upvotes: 1
Reputation: 9078
I've been using this for years, still works great:
footerStickAlt: A more robust method of positioning a footer
http://www.themaninblue.com/writing/perspective/2005/08/29/
Upvotes: 0
Reputation: 7119
I´m not sure if this is exactly what you are asking for, but it is a good resource when it comes to css layout http://matthewjamestaylor.com/blog/perfect-multi-column-liquid-layouts. It also has an article explaining how to add it into a container: http://matthewjamestaylor.com/blog/how-to-convert-a-liquid-layout-to-fixed-width
Upvotes: 1
Reputation: 7395
/**
* The following allows the usage of height=100% in body tag.
* Creds to: http://apptools.com/examples/tableheight.php
*/
html,body
{
margin : 0;
padding : 0;
height : 100%;
border : none;
}
You need to make it so html and body take 100% of the browser viewport.
Upvotes: 2