0

Is it possible to construct a central div that has equal amounts of space on both sides, and another div that is always adjacent to the big one, on it's exterior left side. I tried setting the width, but when I enlarge the page it isn't adjacent anymore.

Forgot to mention, the center div has sa fixed size.

titus
  • 5,512
  • 7
  • 25
  • 39

1 Answers1

2

Is this what you want:

CSS:

#left{
    width:25%;
    background:#cccccc;
    height:500px;
    float:left;
}
#center{
    width:50%;
    background:#adaddd;
    height:500px;
    margin-left:auto;
    margin-right:auto;
}

HTML

<div id="left"></div>
<div id="center"></div>

jsFiddle


In this fiddle center div has equal space on both sides. And central div also have an adjacent left div. Space between both (left and center) div is mostly same in all browser sizes.

Harry Joy
  • 58,650
  • 30
  • 162
  • 207