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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:35:46+00:00 2026-05-25T16:35:46+00:00

I have this html structure: <body> <div id=container> <div id=header>Not empty</div> <div id=content> <div

  • 0

I have this html structure:

<body>
    <div id="container">
        <div id="header">Not empty</div>
        <div id="content">
            <div id="inner_header">Not empty</div>
            <div id="scrollable_content">Very long content</div>
        </div>
    </div>
</body>

I want the page to have a fixed height equal to the height of the screen, and I also want a vertical scrollbar for the div scrollable_content.

I have tried with these styles, but the page I get is larger than the screen, so I get two scrollbars:

html, body {
    height:100%;
}
div#container {
    height:100%;
}
div#scrollable_content {
    height:100%;
    overflow-y:auto;
    position:absolute;
}

How can I do this with CSS3?

Edit: I found a solution using jQuery (see below). I’d like to know if this is possible using only CSS3?

Thanks in advance!

  • 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-25T16:35:46+00:00Added an answer on May 25, 2026 at 4:35 pm

    When you absolutely position an element it comes out of the flow of the page. Please take a look at this fiddle. Note the green box causes two vertical scrollbars to appear.

    http://jsfiddle.net/gX2DG/

    To get a single scrollbar that only appears below the header, you will need to modify your CSS. This CSS works with fixed height headers only.

    1. Zero out margin/padding on html/body and set overflow:hidden so that they do not trigger the main browser scrollbar
    2. Set body to 100% height so that we can set 100% on divs inside of it
    3. Absolutely position the child div that will contain the scrollable content. Then use left, right, top, bottom to stretch it to fill the screen.

    http://jsfiddle.net/J4Ps4/

    /* set body to 100% so we can set 100% on internal divs */
    /* zero margin/padding and set overflow to hidden to prevent default browser scrollbar */
    html, body { height:100%; margin: 0; padding: 0; overflow: hidden; }
    div { margin: 0; padding: 0;  }
    
    /* on child div give it absolute positioning and then use top/bottom to stretch it */
    /* top must be equal to the height of the header */
    div#scrollable_content {
      position: absolute;
      top: 50px;
      bottom: 0px;
      width: 100%;
      overflow-y:auto;
      border: 1px solid green;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this HTML structure and want to convert it to an accordion. <div
Suppose I have this HTML structure: <div class=a> <div class=floated-left>...</div> <div class=floated-left>...</div> </div> I
I have this HTML structure (excerpt): <td> <select id=test1 class=pub_chooser> <option value=99>All Publications</option> <option
I have this html: <div class=foo parent> <div class=child></div> </div> with some css: .foo{
I have this HTML in my page <div id='masterDIV'> <div id='divItemNumber'>23</div> <div id='divDesc'>This is
I have this html page which is very simple, it contains a text box
I have this kind of HTML structure (stripped down for easy readability): <head> <title>My
this is what an html structure of the webpage looks like: <body> <form> <input
I have the following structure. <div> <p>Hello World !!</p> </div> <iframe id="myiframe" src='myiframeContent.html'></iframe> and
Let's say we have a HTML page which has the structure as <html> <body>

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.