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 7492885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:38:56+00:00 2026-05-29T16:38:56+00:00

I am currently building the HTML and CSS for an application I am developing.

  • 0

I am currently building the HTML and CSS for an application I am developing.

This application has a fixed height header, a fixed height footer and a middle area that should take up the rest of the space.

The problem is that I want the header and the footer to stay fixed in place the entire time, while the content scrolls if it becomes too big.

I’ve been able to get the content scrollable with the header and footer fixed in place, but this uses a push div which makes it so the scrollbar disappears behind the header, another option makes it disappear behind the footer.. I am having a hard time getting a div to scroll when it exceeds the max size without giving it a 100% height.

Here is what I have so far:

http://jsfiddle.net/7gmpu/

Is this possible with pure CSS? Or do I have to calculate the window height with javascript every time it resizes?

Is my ‘solution’ even close?

  • 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-05-29T16:38:59+00:00Added an answer on May 29, 2026 at 4:38 pm

    If you want to have your elements fixed, you have to use CSS positioning. Your current solution is already close, however it’s a little bit complicated.

    Say you want to have three blocks:

    HEADER
    CONTENT
    FOOTER
    

    the most natural way is to put them all in a container (not needed if your website consists of only these 3 elements) and position them absolute. For HEADER top is 0, for FOOTER bottom is 0. In CONTENT you have to adjust top and bottom to ensure that it will be the height of your footer/header.

    So if your using a #wrapper, #header, #content and #footer, this is the code you’ll need:

    #wrapper{position:absolute; top:0;bottom:0;width:100%;}
    #header, #footer, #content{position:absolute; width:100%;}
    #header{top:0; background-color:#faa;height:50px;}
    #content{top:50px;bottom:150px; overflow:auto;}
    #footer{bottom:0px; background-color:#afa; height:150px}
    

    Demo

    EDIT: Your updated demo. Don’t specify a height value if you want to use fixed positioning. Use an implicit height instead by defining top and bottom. Also use overflow:auto for scrollbars. I did the following changes:

    #mid {
        background:    #222;
        /* dropped height */
        bottom:50px; /* implicit height */
        overflow:auto; /* automatical scrollbars */
        width:        100%;    
        position:    fixed;
        top:        100px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're currently building an application that executes a number of external tools. We often
I'm currently building a small web application that includes a fair amount of JavaScript.
I am currently building a Rails 3.2 application that uses the gem sunspot to
I'm currently building a WordPress theme that I would like to have a header
I'm currently building a Java app that could end up being run on many
I am currently building an internal web application used in a factory/warehouse type location.
I am currently building an application using ASP.NET MVC. The data entry pages are
I am building a template system for emailing people that currently works in the
In a system that I'm building I want to serve Static files (static HTML
Here is my scenario. I'm am HTML/CSS guy, JavaScript not so much. But this

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.