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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:05:26+00:00 2026-05-24T22:05:26+00:00

Is there a way to have two <div> containers, one having a static height,

  • 0

Is there a way to have two <div> containers, one having a static height, and a second underneath dynamic, basically just takes up the remaining portion of the viewport?

Inside the the dynamic container, if there is overflow within, the container itself would show scrollbars accordingly. That way the viewport should ever need a y-axis scrollbar.

Example

Any ideas? Would it require a lot of scripting or could it be done purely with css?

  • 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-24T22:05:27+00:00Added an answer on May 24, 2026 at 10:05 pm

    I would do it like this: http://jsfiddle.net/tw16/X5rWb/

    CSS:

    .content{
        border: 1px solid red;
        overflow-y: auto; /* now scrollbars will only appear when needed */
        overflow-x: hidden;
    }
    

    jQuery:

    $(function () {
        adjustHeight();
    });
    
    $(window).resize(function () {
       adjustHeight();
    });
    
    function adjustHeight() {
        var windowHeight = $(window).height() - 2;
        var headerHeight = $('.header').outerHeight();
    
        $('.content').height(windowHeight - headerHeight);
    }
    

    The 2 in windowHeight comes from adding the 1px top and 1px bottom border of the .content div together.

    Using outerHeight() for the .header means there is no need to make any additions as the top and bottom padding and borders are included. If you were to use outerHeight(true) this would also include the top and bottom margin.

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

Sidebar

Related Questions

Is there any way to have this: [one[two]][three] And extract this with a regex?
Is there a way in C# to merge two dictionaries? I have two dictionaries
If I have two tables... Category and Pet. Is there a way in LINQ
I have two keyboards connected to my PC, is there any way to know
Is there any way to list all the files that have changed between two
I have this unordered list <ul> <li>two</li> <li>three</li> </ul> Is there a way I
Is there any way to have something that looks just like a file on
I have a main div which contains two divs. One for main content and
I have two questions. Is there a way to sort collection from ActiveRecord or
I have two divs placed inside a larger div. Each one of these two

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.