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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:08:57+00:00 2026-05-31T15:08:57+00:00

I have the following HTML: http://jsfiddle.net/fMs67/ . I’d like to make the div2 to

  • 0

I have the following HTML: http://jsfiddle.net/fMs67/. I’d like to make the div2 to respect the size of div1 and scroll the contents of div3.

Is this possible?

Thanks!

UPDATE-1:

This is the more advanced case that I oversimplified when I asked the question: http://jsfiddle.net/Wcgvt/. I need somehow that header+it’s sibling div to not overflow the parent div’s size.

  • 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-31T15:08:58+00:00Added an answer on May 31, 2026 at 3:08 pm

    Adding position: relative to the parent, and a max-height:100%; on div2 works.

    <body>
      <div id="div1" style="height: 500px;position:relative;">
        <div id="div2" style="max-height:100%;overflow:auto;border:1px solid red;">
          <div id="div3" style="height:1500px;border:5px solid yellow;">hello</div>
        </div>
      </div>
    
    </body>​

    Update: The following shows the “updated” example and answer. http://jsfiddle.net/Wcgvt/181/

    The secret there is to use box-sizing: border-box, and some padding to make the second div height 100%, but move it’s content down 50px. Then wrap the content in a div with overflow: auto to contain the scrollbar. Pay attention to z-indexes to keep all the text selectable – hope this helps, several years later.

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

Sidebar

Related Questions

I have the following HTML & CSS: http://jsfiddle.net/j8aFS/1/ When you decrease the window size,
I have the following code: http://jsfiddle.net/cosoroaba/nCEwv/ HTML: <div id=square> <div class=corner-wrapper> <div id=ctr></div> </div>
I have following code (html,js,jquery) snippet ( http://jsfiddle.net/MUScJ/2/ ): <script type=text/javascript> function someFunc(){ html
In the following HTML/CSS example http://jsfiddle.net/Hmwvv/ we can notice a leading space with size
I have an HTML CSS Query. I have the following JS Fiddle. http://jsfiddle.net/NC9NL/ If
I am sure this is simple but... I have the following: http://jsfiddle.net/SUBH3/1/ HTML: <div
I have the following code in HTML/CSS: http://jsfiddle.net/XmRNh/ As you can see, there is
I have the following HTML/Javascript code: http://jsfiddle.net/xxwa7/ and I am trying to submit the
I have the following code, for instance: JSFiddle: http://jsfiddle.net/ntcg3/4/ HTML: <html> <p class=hey>hi</p> </html>​​​​​​​​​​​
I have the following HTML - http://jsfiddle.net/X763j/ What I am trying to do is

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.