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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:49:27+00:00 2026-05-27T17:49:27+00:00

I have been trying to achieve a two-column layout with CSS where the left

  • 0

I have been trying to achieve a two-column layout with CSS where the left column is for navigation(don’t hold a vertical nav against me) and the right column is for content. The length of the content varies, but is always longer than the right column navigation. I am also aiming for at least gracefully degradation in <=IE7 and no JavaScript if I can help it.

I see there are other questions that aim for somewhat similar things, and that was how I found this article.

After trying to apply it my design, I came up with something I thought would work.

jsfiddle here: http://jsfiddle.net/FVsSV/2/

Relevant HTML:

<div id="mainCont">
<div id="sidebar">
    <a href="#">dapibus sit a</a>
    <a href="#">dapibus sit a</a>
    <a href="#">dapibus sit ag</a>
    <a href="#">dapibus sit a</a>
    <a href="#">dapibus sit a</a>
    <a href="#">dapibus sit a</a>
    <a href="#">dapibus sit a</a>
</div>
<div id="content">
    <div id="padding-wrapper">
        <h1>uris et lorem gravida condiment</h1>

        <h3 id="toc">apibus sit am</h3>
            Content content content...
    </div>
</div>
</div>

Relevant CSS:

#mainCont {
  background-color: #000;
  overflow: hidden;
  padding-left: 148px; /* The width of the rail */
  height:1%; /* So IE plays nice */
}



#sidebar {
    display: inline;
  background-color: #9BBCE4;
  width: 148px;
  float: left;
  margin-left: -148px;
}


#sidebar a {
    display: block;
    padding: 15px 0px;
    font-size: 1.1em;
    text-align: center;
    color: #2C2C2C;
    text-decoration: none
}

#sidebar a:hover {
    background-color: #4e88ce;
    color: #FFFFFF;
}

#content{
    background-color: #FFFFFF;
  width:100%;
  border-left: 148px solid #9BBCE4;
  margin-left:-148px;
}

#padding-wrapper {
    padding: 30px 30px;
}

/* content formatting*/
#content h1 {
    font-size: 1.5em;
    margin: 15px 0px 20px 0px;
}

/* content formatting END*/

It looks just fine in FF8 and IE8, but when I checked it in IE 7 and “compatibility view”, it looks pretty messed up and I’m not sure what the cause is or whether it can be easily fixed.

Is it something obvious that I’m missing, or is this method not worth trying for IE6-7 compatibility?

  • 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-27T17:49:28+00:00Added an answer on May 27, 2026 at 5:49 pm

    I believe this has to do with how IE7 handles specific widths and negative margins. Correct me if I’m wrong, but IE7 doesn’t suffer from the same box-model issues as IE6 does, but it still doesn’t get it quite right. (Maybe it does have the same box-model issue and this is the manifestation of it?) When you set the padding on the container (as you have with padding-left:148px), IE7 incorrectly adds that to the relative width used by child objects. When you then set a child object with width:100%, you end up with a child that’s too wide to fit into the space provided by the parent.

    With the sidebar appearing first in the HTML and floated, the content should flow around it, but since IE7 thinks it’s too wide for the container, it forces it onto the first line after the floating object. @Scott is correct – if you remove the width:100% from the CSS rule for the content div, it flows correctly in IE7. (I can’t personally verify this in IE6, though.)

    What we should learn from this, of course (beyond the headaches from working with IE), is that negative margins can cause some odd behavior and should probably be avoided in most scenarios. With that being said, though, your approach to a two-column layout with the background of the shorter column matching the height of the longer column is intriguing.

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

Sidebar

Related Questions

I have been trying very hard to achieve rounded corners with IE6+jquery ui tabs.
I am trying to remove two viewcontrollers (that have been added on top of
I've been trying to make it impossible to have two checkboxes checked at the
I am trying to remove two viewcontrollers (that have been added on top of
I have been trying to achieve ClickOnce deployment using MSBuild scripts, but I could
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss]
I have been trying to determine a best case solution for registering a COM
I have been trying to work my way through Project Euler, and have noticed
I have been trying to get around this error for a day now and

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.