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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:47:29+00:00 2026-05-24T06:47:29+00:00

Good morning, I am attempting to create a centered 3 column layout (h1, h2,

  • 0

Good morning,

I am attempting to create a centered 3 column layout (h1, h2, h3) inside of a centered container div which has a width of 90%.

h1 and h3 are a fixed width b/c of the width of my background image and h2 should be 100% of the remainder of the space. I’m able to make this work using specified widths but I would like to avoid that in case a user would like to view the page < 800px.

the css:



    #home-container {
      background-image:url('/images/bg.png');
      background-repeat: repeat-x;
      text-align: center;
      margin-left: auto;
      margin-right: auto;
      width: 800px;
    }

    #h1 {
      background-image:url('/images/navbar_left.png');
      background-repeat: no-repeat;
      width: 27px;
    }

    #h2 {
      background-image:url('/images/navspacer.png');
      background-position: center top;
      background-repeat: repeat-x;
      width:746px;
    }

    #h3 {
      background-image:url('/images/navbar_right.png');
      background-position: right top;
      background-repeat: no-repeat;
      width: 27px;
    }

    #h1, #h2, #h3 {
      float:left;
    }


the html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>3col test</title>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
    <link rel="stylesheet" type="text/css" href="/stylesheets/main.css" media="all" />
  </head>
  <body>
      <div id="home-container">
        <div id="h1">1</div>
        <div id="h2">2</div>
        <div id="h3">3</div>
      </div>
  </body>
</html>

  • 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-24T06:47:30+00:00Added an answer on May 24, 2026 at 6:47 am

    There may be easier answers, but here is one way of doing it:

    Working solution: http://jsfiddle.net/W8Bwe/1/

    Basically, embed h1 and h3 inside h2, floated left and right respectively.

    Then just set the margins on h2, to account for space taken up by h1 and h3.

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

Sidebar

Related Questions

Good morning. I have an XML file which contains lists of warning and errors
Good Morning How to create a new plist in iphone? it is possible please
Good morning! We have a SVN-Repository, which holds a VS-Solution. In this solution are
Good morning, I´m facing a very strange problem on which I haven´t found a
Good Morning, I have an application which allows users to slide values for different
Good Morning All, I have created a different background and a few other images
Good morning, I am about to start writing an Excel add-in for Excel 2002.
Good morning, I am the developer of a medium sized PDA application that will
Good morning, I work in a small shop (only two of us) and we
Good morning, I am working on a C# winform application that is using validation

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.