Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

100% Css-layout with header and footer

Tags:

css

height

layout

I'm trying to create a layout with a header and footer (both of which have a fixed heights) and a content-div between them that is fills the remaining space. Within the content-div I want to have divs with heights that are based on percent values (with the content-div's heihgt as parent). I can't figure out how to do this?

Here is an illustration of what I'm trying to accomplish. layout example

like image 671
Snail Avatar asked Jul 06 '10 12:07

Snail


Video Answer


1 Answers

[See it in action]

  #header { 
    position:absolute; 
    height: 50px; 
    left:0; 
    top:0; 
    width:100%; 
    background:green;
  }

  #footer { 
    position:absolute; 
    height: 50px; 
    left:0; 
    bottom:0; 
    width:100%;
    background:green;
  }

  #content { 
    position: absolute; 
    top:50px; 
    bottom:50px; 
    left:0;
    width:100%;
    background:#eee; 
  }

  #box1 { 
    height:50%; 
    width:30%; 
    float:left; 
    background:red; 
  }
like image 195
25 revs, 4 users 83% Avatar answered Dec 05 '22 16:12

25 revs, 4 users 83%