If you wrapped your divs, like this:
<div id="main"> <div id="sidebar"></div> <div id="page-wrap"></div> </div>
You could use this styling:
#main { width: 800px; margin: 0 auto; } #sidebar { width: 200px; height: 400px; background: red; float: left; } #page-wrap { width: 600px; background: #ffffff; height: 400px; margin-left: 200px; }
This is a slightly different look though, so I’m not sure it’s what you’re after. This would center all 800px
as a unit, not the 600px
centered with the 200px
on the left side. The basic approach is your sidebar floats left, but inside the main div, and the #page-wrap
has the width of your sidebar as it’s left margin to move that far over.
Update based on comments: For this off-centered look, you can do this:
<div id="page-wrap"> <div id="sidebar"></div> </div>
With this styling:
#sidebar { position: absolute; left: -200px; width: 200px; height: 400px; background: red; } #page-wrap { position: relative; width: 600px; background: #ffffff; height: 400px; margin: 0 auto; }