tags:

views:

211

answers:

5

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 usingmin-height, but how could I use theheight:100%` ? What I like is that the footer is always visible, and you scroll the content.

Current CSS

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;
}
+2  A: 
/**
 * 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.

ItzWarty
+1  A: 

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

rakke
A: 

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/

Alec
+1  A: 
<!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>

http://jsbin.com/uyezu

Trick is to expand html,body to 100%

Riley
+1  A: 

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.

Saladin Akara