Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8157409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:16:29+00:00 2026-06-06T17:16:29+00:00

Possible Duplicate: CSS – percentage height I can’t get the middle div of 3

  • 0

Possible Duplicate:
CSS – percentage height

I can’t get the middle div of 3 divs to fit 100% of available space.

<body>
<div id="container">
    <div id="header">
    </div>
    <div id="content">
    </div>
    <div id="footer">
    </div>
</div>
</body>

My CSS is:

html, body {
    margin: 0;
    padding: 0;
    border:1px;
    vertical-align:top;
    font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size:14px;
    color:#333;
    height: 100%;
}
#container {
    height: 100%;
    width: 100%;
}
#header {
    height: 100px;
    width: 100%;
    background: #069;
}
#content {
    height: 100%;
    width: 100%;
    background: #F60;
}
#footer {
    height: 75px;
    width: 100%;
    background: #060;
}

Center div is in effect being 100%, but its not fitting available space.

It is doing something like this:
If the screen is 500px

30px
100% (500px)
30px

What I need is:

30px
100% (460px)
30px

Is this possible withouth using javascript?

Thanks a lot

EDIT:
Sorry I meant Height I have 3 elements, header, middle and footer. Header and footer have fixed height, but I want middle to fit all available space

Found another solution based on other stackoverflow question:

* { margin: 0; padding: 0 }
html, body {
    margin: 0;
    padding: 0;
    vertical-align:top;
    font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size:14px;
    color:#333;
    height: 100%;
    border: 0;
}
#header
{
    height: 100px;
    background:#C60;
}

#container
{
    min-height: 100%; 
    height: auto !important; /*Cause footer to stick to bottom in IE 6*/
    height: 100%; 
    margin: 0 auto -100px; /*Allow for footer height*/
    vertical-align:bottom;
    background:#096;
}

#footer
{
    height: 100px; /*Push must be same height as Footer */
    background:#C60;
}

HTML

<body>
<div id="container">
<div id="header"> </div>
<div id="content"> </div>
</div>
<div id="footer"> </div>
</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:16:31+00:00Added an answer on June 6, 2026 at 5:16 pm

    Try something like this jsfiddle.

    html

    <body>
        <div id="wrap">
    <div id="container">
        <div id="header">header
        </div>
        <div id="content">qweW
        </div>
    </div>
    </div>
        <div id="footer">footer
        </div>
    </body>
    

    css

    * { margin: 0; padding: 0 }
    html, body {
        margin: 0;
        padding: 0;
        border:1px;
        vertical-align:top;
        font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size:14px;
        color:#333;
        height: 100%;
        background: #F60;
    }
    #container {
        width: 100%;
        padding-bottom: 75px;
    }
    #wrap {min-height: 100%;}
    #header {
        height: 100px;
        width: 100%;
        background: #069;
    }
    #content {
        height: 100%;
        width: 100%;
    }
    #footer {
        position: relative;
        margin-top: -75px;
        clear:both;
        height: 75px;
        width: 100%;
        background: green;
    }
    

    I tweaked your HTML to add a “wrapper” around the “container” div, and move the “footer” out of both.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: CSS - Equal Height Columns? I have 3 divs. Like this: <div
Possible Duplicate: Remove CSS from a Div using JQuery we can set backgroung-image property
Possible Duplicate: Change CSS Dynamically I need to change the height of a div
Possible Duplicate: Css z-index problem Is there away that I can get the border
Possible Duplicate: Give a CSS styled div a “border-left-image” Im trying to put a
Possible Duplicate: CSS - Equal Height Columns? I'm not the greatest with css, so
Possible duplicate: why does the css min-width attribute not force a div to hae
Possible Duplicate: How to write a:hover in inline CSS? Can someone show me an
Possible Duplicate: Change an element's CSS class with JavaScript I'm trying to set div's
Possible Duplicate: How do I get this CSS text-decoration issue to work? I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.