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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:44:36+00:00 2026-06-01T13:44:36+00:00

I have an apparently easy problem which is: <div class=container> <div class=a></div> <div class=b></div>

  • 0

I have an apparently easy problem which is:

<div class="container">
    <div class="a"></div>
    <div class="b"></div>
    <div class="c"></div>
</div>​

I have 3 divs inside a container: A and B have fixed heights. C must have an extendable height, it extends along with the container height. If the content inside C are too big, I’d like C to scroll but to keep A and B in the same place.

Code in: http://jsfiddle.net/V2c9G/

I’m not able to do it.

I tried:

<div class="container">
    <div class="a"></div>
    <div class="b"></div>
    <div class="xxx" style="overflow-y:scroll">
       <div class="c"></div>
    </div>
</div>​

without success. The container div it’s supposed to resize along the browser.

A complex example would be http://www.sencha.com/examples/#overview (I’m talking about the layout, make the browser smaller and you will see scrolls apperaring hile the headers keeps fixed) but it’s not a solution since it uses JS to recalculate the heights.

Any idea?

  • 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-01T13:44:37+00:00Added an answer on June 1, 2026 at 1:44 pm

    Edit 3:

    This is my recommended solution, which uses CSS from the Edit 2 below as a fallback, but uses JavaScript to resize your divs appropriately onload and when your window size changes. The CSS solution provides a decent starting point if the client has JavaScript disabled, and the JavaScript is such that it really shouldn’t affect the performance of the page, so I see no reason not to use JavaScript to perfect what you want to see. A working fiddle can be seen here. Also, here is the appropriate JavaScript code:

    var resizeDiv = function(){
        document.getElementById('c').style.height = getWindowHeight() - 64 + 'px';
    };
    
    //Framework code
    var getWindowHeight = function(){
        if (window.innerHeight) {
            return window.innerHeight;
        }
        if (document.body && document.body.offsetHeight) {
            return document.body.offsetHeight;
        }
        if (document.compatMode=='CSS1Compat' &&
            document.documentElement &&
            document.documentElement.offsetHeight ) {
            return document.documentElement.offsetHeight;
        }
    
        return 740;//provide a default height as a fallback
    };
    
    //resize on pageload
    window.onresize = resizeDiv;
    setTimeout(resizeDiv);
    


    I think you need to adjust the absolute height on your third div to take up the rest of the space (either absolutely or with percentages), set overflow to hidden on the parent div, and let the content in the third inner div determine whether to show the scrollbar or not. Here’s an updated fiddle using the absolute height method.

    Edit:

    From your “Imagine the container is the browser” comment (which to me means the scrollbar should be on the container), all you’d really have to do is set the overflow to ‘scroll’ and height in the third div to ‘auto’. Here’s an updated fiddle for that.

    Edit #2:

    According to your comment on this question, it sounds like you need to go with the percentage method. The most straightforward would be to make the height of a, b, and c a percentage (I had to tweak the margins to get it to fit for all zooms). Unfortunately with this method, the top components will not be fixed, and it sounds like you may be displaying static content there that would look funky. Thus, another option is to pick a minimum supported size for your browser window and adjust the percentage of the third element so that it just fits. Here’s a fiddle for that. However, the downside there is that you’ll have more empty space at the bottom of the page the bigger the height of the window, and you’ll have 2 scrollbars below a certain height. To really do this properly with the fixed sized divs at the top, you’ll need to add an event listener to the window.resize method and resize your third div when that happens appropriately based on the new size of the window.

    Note: It is times like this where I wish the W3C would approve percentages plus pixels for their height, width, and other sizing properties!

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

Sidebar

Related Questions

I have a set of data points in 3D space which apparently all fall
so apparently you have the following <select> <option value=0>One</option> <option value=1>Two</option> </select> $('select').val('1'); //
I'm only remotely familiar with what ant does, but apparently I have to setup
I have an issue with SQLAlchemy apparently committing. A rough sketch of my code:
Paramiko's SFTPClient apparently does not have an exists method. This is my current implementation:
I have this sql: ALTER TABLE dbo.ChannelPlayerSkins DROP CONSTRAINT FK_ChannelPlayerSkins_Channels but apparently, on some
You can't have your cake and eat it too, apparently. I'm currently using the
I'm trying to use Enumerable.ToList() in PowerShell. Apparently, to do that, I have to
This seems like it should be so simple, but apparently it isn't. I have
I am working on an image manipulation problem. I have an overhead projector that

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.