Here is a summary of my layout method, which is used on many sites, it can take any number of columns, but this example just does your left hand:
the sample shows that the footer will always remain below the longest column
the sidebar can be of any width, just changing the edge of the content to fit, you can even swim with the two side panels to the left - then just increase the border by #content
to clear them.
Alternatively (or also), the sidebar (or 2) can be placed on the right, then you just put the div #content
on the right and not the left to βclearβ them.
This is an ordered source, content in front of the sidebars .. it can include any number of headings and sub-headings of headings (or under the content) without affecting the main area of βββcolumnsβ, and you can swim with your sidebars (if there are several) in any order too ... thus changing its order, width, number even after the fact, only with CSS
I think that my layout technique may have even been included in some Drupal themes and is used, of course, it was also used on some larger sites, but I lost the track .. it never let me down :)
here is the template code.
CSS
html, body {padding: 0; margin: 0;} #footer,#header {background: #444; color: #fff; clear: both;} #container { overflow: hidden; width: 100%; } #contentwrap { float: left; width: 100%; margin-right: -100%; } #content { margin-left: 270px; padding: 20px; border-left: 1px solid #444; } #sidebar { float: left; width: 230px; padding: 20px; background: #dad; border-right: 1px solid #444; }
HTML:
<div id="header">header</div> <div id="container"> <div id="contentwrap"> <div id="content"> <h1>Content remaining width</h1> <p>add more content here</p> <h2>Header Level 2</h2> </div> </div> <div id="sidebar"> <p>short sidebar</p> <p>add more content here until this gets longer than main and the footer will still stay below</p> </div> </div> <div id="footer">footer</div>
It is really very flexible since the side panels can also be fixed width or fluid and it will work with ems,%, px .. you name it
yes I am attached to this code;)
Edited to add If the older IE (6) does create problems with float / hovers inside the content area, for the div #content
may need to havelayout set, if you just add zoom: 1;
to him actually in my layouts, I am still out of habit!