With fixed width side columns, this is actually very simple. You will want to use floats, and you may need the faux columns trick depending on your specific design needs.
You need something line by line:
<div class="left"></div> <div class="right"></div> <div class="middle">Content</div>
and
div { -moz-box-sizing: border-box; box-sizing: border-box; } .left { float: left; width: 100px; background: #f00; } .right { float: right; width: 100px; background: #00f; } .middle { width: 100%; padding: 0 100px; background: #ccc; }
See here in action (this is without the effect of an artificial column, but should give you a starting point). If you change the width of the section with the output, you will see that the columns remain included and the content remains within the outer columns.
The content column should be the last because it is still in the document stream, so the right column will be below the content.
Alternatively, you can use position: absolute; on their side columns something like this:
.wrapper { position: relative; } .left { position: absolute; top: 0; left: 0; } .right { position: absolute; top: 0; right: 0; } .middle { padding: 0 100px; } div { -moz-box-sizing: border-box; box-sizing: border-box; }
These tricks will work in IE8 +, Firefox, Chrome, Safari and Opera. IE7 may have problems due to the use of the W3C box model (βcontent boxβ) and not CSS box-sizing recognition, but there are a few tricks to make it work if you need it. IE6 should be fine, because the default is to use a field model with a border-box. (You may need to play with z-index to make IE behave. If so, set .middle{ position: relative; z-index: 1} and add z-index: 2 to the left and right columns.)
The position: absolute trick has the advantage over floating in that your sidebars can appear before or after the contents of the div, which makes it potentially more semantic.
The reason they work is because: a) your side columns are fixed, so we just set the filling to the width of these columns and b) position: absolute and float: [left/right] extract elements from the document flow, which means that in relation to the document they are absent and do not take up space. This allows other elements to move to where these elements were used, laying them on top of each other.