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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:30:31+00:00 2026-05-23T22:30:31+00:00

Just need help as I have been trying sort this out for ages now.

  • 0

Just need help as I have been trying sort this out for ages now. What I need:

I’ve got a 2 column layout, where the left column has a fixed width 220px and the right column has a fluid width.

Code is:

    <!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">
 <head>
     <title>Fluid</title>
    <style type="text/css" media="screen">
        html, body { background: #ccc; }
        .wrap      { margin: 20px; padding: 20px; background: #fff; }
        .main      { margin-left: 220px; width: auto }
        .sidebar   { width: 200px; float: left; }
        .main,
        .sidebar   { background: #eee; min-height: 100px; }
    </style>
</head>
<body>
    <div class="wrap">
        <div class="sidebar">This is the static sidebar</div>
        <div class="main">This is the main, and fluid div</div>
    </div>
</body>
</html>

There’s no problem at all. When I use a css syntax clear: both in the right column, all content after gets moved under the left column. This is a right behaviour and nothing against it.

But I relly need to use clear: both in the way, that it stays just in context of the right column (doesn’t get affected by the left column at all, and doesn’t move underneath)

Is there any simple get around with retaining a basic float concept of page design?

UPDATE: Please see this link to know what I’m on about as it may be a bit confusing from my description.
Link: http://jsfiddle.net/k4L5K/1/

  • 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-23T22:30:32+00:00Added an answer on May 23, 2026 at 10:30 pm

    Here’s your altered CSS:

    html, body {
        background: #ccc;
    }
    
    .wrap {
        margin: 20px;
        padding: 20px;
        padding-right:240px;
        background: #fff;
        overflow:hidden;
    }
    
    .main {
        margin: 0 -220px 0 auto;
        width: 100%;
        float:right;
    }
    
    .sidebar {
        width: 200px;
        float: left;
        height: 200px;
    }
    
    .main, .sidebar {
        background: #eee; min-height: 100px;
    }
    
    .clear { clear:both; }
    span { background: yellow }
    

    Basically what I’ve done is change the way your layout is done, so that .main div is floated on the right. To do this, we had to add 2 things:

    1. A padding of 240px on the .wrap div, and
    2. A right margin on the .main div of -220px to properly align the fluid part of the page.

    Because we’ve floated the .main div on the right, the clear: both; now only affects content inside the .main div, as you want.

    You can see a demonstration here: http://jsfiddle.net/6d2qF/1/

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

Sidebar

Related Questions

I really need some help with this as I have been trying to fix
I really really need help. Been trying to get this on and off for
for the last hour I have been trying to figure this out myself but
I need some help with some CSS coding. I have been trying to get
I need some help with jQuery script again :-) Just trying to play with
I'm just starting out with the whole ajax thing and I need some help.
I have been trying to solve a PHP regular expression problem for awhile now
Ok, I have been trying to wrap my head around this http live streaming.
This code does not seem to compile, I just need to write something to
Seems so basic, I can't believe I don't know this! I just need a

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.