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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:22:17+00:00 2026-06-02T16:22:17+00:00

I have two floating divs next to each other, and want the left one

  • 0

I have two floating divs next to each other, and want the left one to stretch to whatever size the right one is. Is this possible with css alone?

<div class="page">
    <div class="left-sidebar">
    </div>
    <div class="right-content">
    </div>
</div>

.left-sidebar
{
    background: url('ImageUrl') no-repeat right top #F8F1DB;
    float: left;
    width: 203px;
    min-height: 500px;
    height : auto;
}

.right-content
{
    background: #F8F1DB;
    margin-left: 203px;
    min-height: 477px;
}

It ends up looking like this:

-------------------
|    |            |
|    |            |
|    |            |
|    |            |
|    |            |
-------------------

The left sidebar frame has a background image, and should stretch to whatever height the content frame does, however I am having problems making that happen.

Is there a cross-browser way to make the left-sidebar div stretch the same height as the right-content frame using css only?

  • 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-02T16:22:18+00:00Added an answer on June 2, 2026 at 4:22 pm

    The best I could come up with is to use position: absolute on the .left-sidebar element:

    .page {
        position: relative; /* causes the left-sidebar to position relative to this element */
    }
    
    .left-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;  /*  this line, and the one above, confer full-height */
        left: 0;
        width: 30%;
        background-color: #f90; /* adjust to taste, just to see where the element was rendered */
    }
    
    ​.right-content {
        background-color: #f00; /* again, adjust to taste, was just to see where elements were rendered */
        margin: 0 0 0 35%; /* stops the sidebar showing 'above' the content, and gives a 5% gutter between */
    }​
    

    JS Fiddle demo.


    Edited in response to comment below:

    There is a header and some space on either side of the floating divs, so I don’t know the actual top/left/bottom positions to use. Also, if the right content frame stretches longer, the left sidebar frame doesn’t stretch with it (add height: 500px to the right content frame of your fiddle).

    Unfortunately the only other alternative that I can see is to move the .left-sidebar element within the .right-content element, and then the following works. This may not be possible with your use-case, though.

    .left-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 30%;
        background-color: #f90;
    }
    
    .right-content {
        position: relative;
        background-color: #f00;
        margin: 0;
        padding: 0 0 0 35%;
    }​
    

    JS Fiddle demo.

    • 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 on a page: one floating left and the other right:
I have two divs floating next to each other, with class name div1 and
I have two divs that are floating next to each other. What i would
I have two divs, one with float: left and the other one with float:right.
Suppose I have an div. Inside this div, I have two divs floating left,
I have two divs within a container. One floats left and one floats right.
I have two div's in a container div, one floating left, one floating right.
I am dynamically parsing DIVs which are floating left to each other in two
I have 3 divs floating next to each other in a containing div. The
I have two floating divs, each is 50% wide, the problem I have 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.