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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:52:34+00:00 2026-05-13T10:52:34+00:00

I want to have two div’s side-by-side with the left one fixed and the

  • 0

I want to have two div’s side-by-side with the left one fixed and the right one filling the rest of the screen.
However, when the right div contains content which goes beyond its available width, the right-hand div should not drop below the left Div but become scrollable. That is, the two Div remain side-by-side and the right Div has a scroll bar.

Setting a width % on the right div sort of shows what I’m after but the right Div never fills the remaining space, its like you need to set the right Div width to 100% – leftDiv.width…

Here’s what I’ve got.

Thanks

<style type="text/css">
#leftDiv{
    width: 200px;
    float: left;
} 

#rightDiv{
    float: left;
    overflow: auto;
    /* width: 50%; */
}
</style>

<div id="leftDiv">
    Left side bar
</div>
<div id="rightDiv">
    Some_really_long_content_which_should_make_this_Div_scroll
</div>

EDIT

I can get the effect I’m after with some jQuery like this but I’d prefer a css only solution.

$(window).bind('resize', function () {
    $('#rightDiv').width($(this).width() - 220 );

}); 
  • 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-13T10:52:35+00:00Added an answer on May 13, 2026 at 10:52 am

    Wow, this is a tough one. Most websites have fixed width to avoid such issues.

    I believe the following is what you want. I’ve tested it in firefox, ie, and safari. You’ll have to mess around with the height to get that perfect for ie.

    Note: I’m not sure how this will work for other doctypes.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>foo</title>
        <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    </head>
    <body>
    
    <style type="text/css">
        * { 
            border:none;
            margin:0;
            padding:0;
        }
    
        #leftDiv {
            float: left;
            width: 200px;
            background-color:lightgreen;
            position:absolute;
            top:0px;
            left:0px;
        }
        #rightDiv {
            width:100%;
            background-color:lightblue;
        }
        #padder {
            padding-left:200px;
        }
        #content {
            width:100%;
            height:100px;
            background-color:lightyellow;
            overflow:auto;
        }
    </style>
    
    <div id="leftDiv">
          Left side bar
    </div>
    <div id="rightDiv">
        <div id="padder">
            <div id="content">
                right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_right_div_
            </div>
        </div>
    </div>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two div's (side by side) inside a parent div, i want right
I want to have two button in the same size one in the left
I want to have two Emacs windows on the screen: one for Dired and
I have two div columns sidebar(left) and page-content(right). I toggle removing and adding 'sidebar'
I have two <div> elements that I want to position side by side like
I have two <div> s on my page. I want to arrange them side-by
I have two div, one on the left and the other is on the
I have two image div in HTML i want that onclik of one image
I have a class of div MyClass I want to hook up to two
I have two forms on one page and want to have the input boxes

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.