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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:54:37+00:00 2026-06-15T14:54:37+00:00

I have the following ( jsfiddle ): <div class=content_wrap> <div class=left_container> </div> <div class=right_container>

  • 0

I have the following (jsfiddle):

<div class="content_wrap">
    <div class="left_container">
    </div>

    <div class="right_container">
        <div style="background-color: blue; margin:20px; height: 1500px;"></div>
    </div>

    <div class="clearfix"></div>
</div>

</body>
</html>

CSS:

body,html {
    height: 100%;
    width: 100%;
    background-color: #f8f8f8;
}

div.content_wrap {
    width: 100%;
    height: 100%;
}

div.left_container {
    float:left;
    width: 220px;
    height: 100%;
    background-color: red;
}

div.right_container {
    position: relative;
    padding: 15px;
    padding-top: 100px;
    width: 1000px;
}

.clear { clear: both; }

​What I’m trying to do is line the divs side by side and have the left side bar (red) stretch to either the height of the page, or the height taken up by the content (which is in blue), which ever is greater (like the layout shown here)

My problems at the moment are:
The content of the right container (The blue box is just to illustrate content) does not align properly next to the left container
The left container doesn’t adjust its height according to the content of the right container.

I’ve put in a clear fix, although to be quite honest, I don’t completely understand how that works.

Would appreciate some guidance.

  • 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-15T14:54:38+00:00Added an answer on June 15, 2026 at 2:54 pm

    See this demo: http://jsfiddle.net/PaJ3r/9/
    Here is updated CSS for it:

    body,html {
        height: 100%;
        width: 100%;
        background-color: #f8f8f8;
    }
    
    div.content_wrap {
        width: 100%;
        position: relative;
    }
    
    div.left_container {
        float:left;
        position:absolute;
        width: 220px;
        height: 100%;
        background-color: red;
    }
    
    div.right_container {
        position: relative;
        padding: 15px;
        margin-left: 220px;
        padding-top:100px;
        width: 1000px;
    }
    
    .clear { clear: both; }
    

    position:relative in div.content_wrap is needed in order to get left sidebar stretched to the height of content.
    position:absolute; in div.left_container allows left container to fit height of wrapper div.
    In div.right_container there is margin-left: 220px; which leave left sidebar visible

    • 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 and CSS in a jsfiddle : <div class=MyBox> <div
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 the following HTML: <div id=header> </div> <div id=content> <div id=test></div> <div style=height:1280px;></div>
I have the following div : <div id=query style=width:500px; height:200px;border:1px solid black spellcheck=false contenteditable=true></div>​
I have the following markup: http://jsfiddle.net/dy4TG/3/ <div class=slide-wrap> <div class=slide> <div class=text>Text here</div> <img
Alright, let's say that I have the following markup: <div class=ticker> <p>News Item One.
I have the following HTML: <div class=row1> <input type=radio name=group1 value=0 checked=checked/>Zero <input type=radio
I have the following code: HTML: <div id=login class=transparent-div login_leaf_class> <input class=pointer login_fields_button id=submit_button
We have the following form: <div class=form-horizontal> <fieldset> <legend>Reports</legend> <div class=control-group> <label class=control-label>Year</label> <div
Consider following HTML, I have a div class magic inside main . The magic

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.