I was trying to solve the problem of how to get background colours to fill the full column heights in a three-column layout, as the shorter columns only extend far enough to cover their contents and so don't line up. Being a relative beginner at all this, I looked both in my web-design book and on the internet for how to go about it - and most advice seemed to be either for the faux-columns way, using repeated images, or the huge padding/negative margin overflow way, neither of which seemed ideal. Or other hacks of similar complexity.
But then I thought of using two extra divs - one around the left and central columns, with the central column's own background-color set and the left column relying on the background-color of the extra div to show through its transparency, becoming its background. The containing div naturally extends to the height of the longest column, and so too does the background colour. Same with the larger div, taking care of the background colour of the right column. (brief outline of the HTML structure at Pastebin
here)
And with all the divs floated to the left (except possibly the centrecolumn floated to the right), that seems to have solved the problem. But while there have been many solutions suggested on the internet, I don't seem to see this one around - it seems to work really well with most browsers (although it took a little more work with IE6), and I got it to work for the website I'm building in both fixed and liquid layouts. (I used the #wrapper as the #rightcolumnbackground there, which meant I really only had to add one div.)
Are there cons to this I'm not seeing? Or are the book and all the articles I read on this just out of date? What's the easiest way to solve the problem right now?
posted by jeb at 7:50 PM on March 15