0

i have a layout based on divs like this:

<div id="master">
 <div id="header">Header</div>
 <div id="menu">Menu</div>
 <div id="content">Content</div>
 <div id="footer">Footer</div>
</div>`

All vertical aligned.

HTML, body height is 100% same goes for master div. when i set content div to 100% it expands and gives me scroll bar.

My goal is to get content div to fill out the rest. putting footer to bottom and header & menu on top.

I cannot seem to achieve this.

any help?

2 Answers2

0

I guess it is your body's margin or padding. Try resetting them:

#master {padding-top: 0; padding-bottom: 0; overflow: auto;}

Fiddle: http://jsfiddle.net/Cj8YV/1/

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
0

You'll find many helpful answers if you search for "push footer down", for instance this: How do you get the footer to stay at the bottom of a Web page?

If your footer height is fixed, try restructuring the HTML code like so:

HTML

<html>
<head>...</head>
<body>
<div class="wrapper">
header, content and menu goes here
<div class="push"></div>
</div>
<div class="footer">footer</div>
</body>
</html>

CSS

Include the following CSS (I copied the code from the linked answer and put in some background colors, so it can be tested easily):

* {
    margin: 0;
}
html, body {
    height: 100%;
}
.wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
    background: red; /* demo */
}
.footer, .push {
    height: 142px; /* .push must be the same height as .footer */
}
.footer {
    background: blue; /* demo */
}
Community
  • 1
  • 1
tmh
  • 1,385
  • 2
  • 12
  • 18