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

  • Home
  • SEARCH
  • 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 4054706
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:36:34+00:00 2026-05-20T14:36:34+00:00

Two column layouts are quite common and until now I implement it as outlined

  • 0

Two column layouts are quite common and until now I implement it as outlined in this question: Right div is floating right and has e.g. width 200px, left div gets a margin-right of 200px.

Therefore, to remove the right div, you have to remove it from HTML and – that’s the unpleasant part – remove the margin-right from the left div.

I’m wondering whether the same can be obtained without making any such changes necessary in the CSS.

Here is the test page: http://pastie.org/1669826

The goal:

div#right present in HTML:        div#right not present in HTML:
+---------------------+           +---------------------+
|                     |           |                     |
+---------------------+           +---------------------+
+----------------+ +--+           +---------------------+
|                | |  |           |                     |
|                | +--+           |                     |
|                |                |                     |
|                |                |                     |
+----------------+                +---------------------+
+---------------------+           +---------------------+
|                     |           |                     |
+---------------------+           +---------------------+

A partial solution which work on FF and WebKit but not on IE: Give div#right a height of 100% and move it inside div#left.

Looking forward to your ideas!

  • 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-20T14:36:35+00:00Added an answer on May 20, 2026 at 2:36 pm

    Assuming equal height columns are desirable, this is a nice method.

    Firstly, make sure you add a doctype as the first line:

    <!DOCTYPE html>
    

    Otherwise you get Quirks Mode = bad, bad, bad.

    Live Demo
    Live Demo (exact same code with right div removed)

    This will work in every modern browser and IE8. It won’t work in IE7 without some crazy hacks.

    Do you need IE7 support?

    <!DOCTYPE html>
    <html>
    
    <head>
    <style>
      #header {
        border: 1px solid green;
      }
      #left {
        border: 1px solid red;
      }
      #right {
        border: 1px solid blue;
        width: 300px;
      }
      #footer {
        border: 1px solid green;
      }
      #container {
        display: table
      }
      #left, #right {
        display: table-cell
      }
    </style>
    </head>
    
    <body>
      <div id="body">
    
        <div id="header">
          <p>Header</p>
        </div>
    
        <div id="container">
            <div id="left">
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
            </div>
    
            <div id="right">
              <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
            </div>
        </div>
    
        <div id="footer">
          <p>Footer</p>
        </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'm trying to use this layout with two 50% column width instead. But it
I have two tables one has a three column composite key. The other needs
The following two queries each give the same result: SELECT column FROM table GROUP
Say I have an MSSQL table with two columns: an int ID column that's
Hi I want to have two tables each have an INT id column which
I have two columns in Excel, like this: A B 0.5 0.4 0.6 0.59
I have a table y Which has two columns a and b Entries are:
I want to update two columns in a table. The value of the second
I have the following two columns: SELECT b.ip_address AS IP ,b.mask AS MASK FROM
I have a table that holds only two columns - a ListID and PersonID.

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.