In January of 2004, [url=http://simplebits.com/]Dan Cederholm[/url] (author of [url=http://www.amazon.co.uk/exec/obidos/ASIN/1590593812/tooyoo-21]Web Standards Solutions[/url]) posted an article on [url=http://www.alistapart.com]AListApart[/url] entitled "[url=http://www.alistapart.com/articles/fauxcolumns/]Faux Columns[/url]". In it, he explained how designers can overcome a common problem in CSS-based designs.
The problem is one that usually rears its ugly head with two and three column designs (though for now, we'll just worry about two columns). If your two columns each have a different background color, how do you make the colours extend to the bottom of the page using css? Equal height columns are difficult to achieve using height and overflow properties. Each column will be of a different height, and you do not always know which is the taller of the two. It is all too easy to end up with a site where one column just doesn't extend all the way to the bottom of the page, where it should end.
CSS does actually include a rather nifty little tool that can be used to work around this problem, the "min-height" declaration, that allows you to specify a minimum height for an element - which you can use to ensure that one specific column is always larger than the other, allowing you to avoid this problem. Unfortunately (and perhaps unsurprisingly) Internet Explorer does not support this declaration, so in practice it isn't a useful solution to the problem.
Dan, in his article (which if you haven't read yet, I suggest you do before continuing), outlines a solution he uses on his own site. This solution involves tiling a background on the page, to give the appearance that there are distinct columns that extend the full length of the page. It's a simple but clever solution, and can be seen in use on a great many sites on the web.
During the recent redesign of this site, though, I came across a small problem. Though Dan's solution is perfect for fixed-width layouts, it just wouldn't work with a percentage-based, liquid layout. The problem was simple - a graphic cannot alter itself based upon the user's screen. If you come up with a background image like the below, and tile it on a page, the left hand column will need to be 200 pixels wide. If your column is 20% of the page, though, that could make it anything from 20 to 2000 pixels - and as a result your columns will rarely look as you intended. This makes equal height columns in liquid layouts a tricky proposal.
However, Dan's solution can be used to apply a background to a page when the layout is liquid, using background positioning.
Background positioning can allow us to give our background the appearance of being liquid. When you positioning a background using pixels, you position the top left corner of the image. When you position a background using percentages or keywords, you don't. Instead, you position a point within the image itself. For example, let's say we have a page and a simple background image. We use the following to set and position the background:
body {
background-image: url("image.gif");
background-repeat: no-repeat;
background-position: 25% 10%;
}
The above will set "image.gif" as the background of the page. It will position the background 25% of the way across the page from the left, and 10% of the way down the page from the top. However, it is not the left hand corner that will appear at that point. It is the point 25% from the left hand side of the background image and 10% from the top that will appear at that point, like so:

We can use this to apply a background to a page that will give the illusion of a pair of columns, even though the columns are not of a fixed width. Let's say we have two columns (for now), of 25% and 75% width. We can create a simple image, 1 pixel tall by 2000 pixels wide (why so wide will become apparent shortly - but don't be afraid to go even larger if you wish - 4000 pixels wouldn't necessarily be a bad thing). We want the left column to be a nice shade of orange, and the right a nice shade of grey, with a black line to divide them. So the image needs to have a black line 25% of the way along, with everything to the left orange and everything to the right grey, like so (scaled for visibility):

Now, we position the background using the following CSS:
body {
background-image: url("background.gif");
background-repeat: repeat-y;
background-position: 25% 0;
}
Now, if you were to draw a line down the page, 25% of the way across from the left hand side, then 25% of our background image would be to the left of that line and 75% to the right. If we use the 2000 pixel wide background mentioned earlier, and position it as above, we'll have an orange background for 25% of the page, a black line, then grey will fill the remaining 75% of the page. You can [url=http://www.addedbytes.com/content/faux-columns-for-liquid-layouts/faux1.html]see an example of that here[/url]. If you resize your browser window, while viewing the example, you will see the columns expand and contract to maintain the same proportions of the columns. With a little imagination, and the use of partly transparent background images, you can create image borders between elements using the same technique.
A little markup and a little more CSS, and we can turn the above into a respectable liquid page, with columns that expand and contract with the users' windows, and always extend just as far as they are needed. A [url=http://www.addedbytes.com/content/faux-columns-for-liquid-layouts/faux2.html]more complete example is here[/url], and this technique is also in use at this very site [please note that this technique is in use in versions 3, 4 and 5 of this site, accessible through the footer], allowing the flexible navigation and content columns to always appear equal in length, despite the fact they almost never are.

28 Comments
Hey man, great site.
I have a fix to that 'min-width' declaration that messes up in IE6.
Here's the code...
<!--[if lte IE 6]>
<style type="text/css" media="screen">
<!--
/* IE min-width trick */
div#wrapper1 {
width:expression(((document.compatMode && document.compatMode=='CSS1Compat') ? document.documentElement.clientWidth : document.body.clientWidth) < 720 ? "720px" : "auto");
}
// -->
</style>
<![endif]-->
</code>
#1, Drew Decker, United States, 26 September 2004. Reply to this.
check this link for a working three-colums-three-row fluid layout working in opera, gecko AND ie6:
http://web2.vs146110.vserver.de/demo/www/index.php?page=index&submodule=1
#2, .m:pror, Germany, 27 July 2005. Reply to this.
That looks impressive. But how could this technique work for a three column layout?
#3, Grim, United Arab Emirates, 14 September 2005. Reply to this.
If you're looking for a 3 column (fixed / liquid / fixed) layout, I have a demo here;
www.mikefinch.co.uk/divdemo4.html
It would be simple to convert to a 3 liquid column layout if required.
#4, Mike, United States, 27 November 2005. Reply to this.
Hello Mike
Thanx for the example page. It works great but it still doesn't address one problem which is height. Is there any way to set the width of left and right column to be 100%?
Thanx
#5, Grim, United Arab Emirates, 8 January 2006. Reply to this.
Your article solved my problem. Thanks a lot!
#6, Tom Becquart, Belgium, 21 January 2006. Reply to this.
Grim,
Did you mean "is there any way to set the HEIGHT of the left and right columns to 100%". If so, does this mean you want the the header and footer to be enclosed by the left and right columns (which should be possible)?
#7, Mike, United States, 11 February 2006. Reply to this.
Thanx for the reply Mike
If you don't have a header and footer and center column contains the contents, how than do you make the left and right column to match the height of the center column which will stretch/shrink with its (dynamic) contents.
Thanx
#8, Grim, United Arab Emirates, 13 February 2006. Reply to this.
Hi Grim,
I've altered the layout on this page, I hope it's okay for you;
www.mikefinch.co.uk/divdemo5.html
The left and right columns will match the height of the centre column as it's resized, but the centre column cannot have a height less than either of the side columns (if that's a problem, I'll think on it).
Cheers,
Mike
#9, Mike, United States, 13 February 2006. Reply to this.
Hello Mike
This looks to be exactly what I was looking for. You have got a solution to every problem. Great and thanx a lot :)
#10, Grim, United Arab Emirates, 18 February 2006. Reply to this.
maybe you guys can point me to some resources I can uise -
the template here
http://www.leorex.com/products/aura/
I was trying to convert to a liquid design like you are talking about but not having much luck - how could I achieve the same results and look style as the bottom of the columns in this template with your technique?
#11, Dylan B, United States, 13 April 2006. Reply to this.
David, thank you very much for your work on this liquid faux column technique. I had previously been using the equal height method that is outlined on www.positioniseverything.com in their 'One True Layout' article. As I am sure you are aware, that technique is hackish and problematic on many fronts. This method is clean and easy to implement. WELL DONE! :)
#12, Jacob Caudill, United States, 5 July 2006. Reply to this.
Perfekt, thank you!
#13, Lars, Germany, 17 July 2006. Reply to this.
I've been using this method for a long time and its worked great... until some new Dells with 125% DPI started rolling out. Now, the background images aren't getting scaled along with the other images on the site. So, if you have an image that's the whole width of one of the columns, the border is very noticeable. Any ways of getting around this?
#14, Joe, United States, 13 October 2006. Reply to this.
Great resource Dave.
...my hope has been restored.
I do notice a bug with your example in IE6...when resizing the window.
http://www.addedbytes.com/faux2.html
I basically need the same thing but it needs to work flawlessly in IE.
My recent problem is using %'s with IE6 (because of rounding error when resizing the window) things disappear off the page.
#15, Anthony Ettinger - web developer, Unknown, 21 December 2006. Reply to this.
Such a great resource Dave. I've been developing sites for coming on 7 years now and your tutorials and tricks have continually returned here. You do some great work and I appreciate it.
#16, Jonathan, United States, 5 March 2007. Reply to this.
Nice example...
If you're up for it - fancy having a go at...
1) Making it EM'able for the side Column.
2) Trying it with 3 Columns.
3) The real killer - 2 and 3 Columns, with transparent gaps between each column so we can see your pretty background.
:)
Personally, I've tried. Hell, I even resorted to scouring the internet and looking things up.
As far as I know, till such time as browsers all work the same way ... *cough at certain browser*, this is not doable.
Still, loved the write up, and keep up the fine work.
#17, Autocrat, United Kingdom, 22 April 2007. Reply to this.
* Apologies - just to clarify my previous "requests"
...imagine that each column is to be distinctly seperate, with say a 15px gap or such between each, whilst appearing as a "pretty box" - lets say curved corners with a slight inner bevel...
As yet, I cannot find a way to do this with the gap between each column (due to column bg's running through and showing up!)
:)
#18, Autocrat, United Kingdom, 22 April 2007. Reply to this.
Would somebody please respond to Joe's question (#14) above? With wider and wider screens, the problem seems set to get worse - or what?
- A rookie
#19, Mandalay, United States, 19 August 2007. Reply to this.
Re: Autocrat -
"...imagine that each column is to be distinctly seperate, with say a 15px gap or such between each, whilst appearing as a "pretty box" - lets say curved corners with a slight inner bevel...
As yet, I cannot find a way to do this with the gap between each column (due to column bg's running through and showing up!) "
=========
Check out http://www.csszengarden.com/?cssfile=200/200.css This is a specific design that seems to do exactly what you describe! (If you actually read the page, it is an exercise in CSS - you can view 'all designs' and then view them by category, such as 2 column, etc) They are all pretty nifty!! And they all use the *same* html file - enjoy!
#20, Suz, Unknown, 25 August 2007. Reply to this.
I'm having an issue with my faux columns in IE6. After taking some time to get what I wanted to work working, IE6 put out yet another problem. View this page in Firefox> http://sheepskinshoestore.com/ecom/ProductDetail.php?id=8690&category=24 everything looks great. But when view this in IE6 on vista all goes a bit to pot! And I can't find a fix for it. Can anyone help?
#21, Steve-0, Unknown, 13 September 2007. Reply to this.
Check out 2columns.net. It can really help in some cases.
#22, 2columns.net Team, Unknown, 7 October 2007. Reply to this.
I scrap it as book now for read tonight,
;-)
#23, amrinz, Indonesia, 1 March 2008. Reply to this.
I appreciate that you make these resources available to everyone.
#24, Gena, US, 22 June 2008. Reply to this.
Kind of what I'm after, but I would like to have a background colour (so an actual <div> tag) 100% height of the browser window.
I nearly got it working by setting body and html to display:block and height:100%, but when my content extended to more than 100% of the browser window, no scrollbars appear.
Any one able to spare a nugget of advice on how to remedy this?
#25, Martin, United Kingdom, 7 July 2008. Reply to this.
What exactly is faux column? This is one of the questions I need to do for my assignment. Please ....
#26, Kay, United States, 21 April 2009. Reply to this.
It doesn't appear anyone else works with the designers I do. They seem to come up with great looking sites that are a pain to mark up. Anyway, I am dealing with a two-column layout where the two 'columns' are separated by a gap where you can see the page's background, which is a vertical gradient. The gradient goes top to bottom from a lighter blue to a darker blue. There is a header above and a footer below the two columns. No 'convenient' solid colors where the columns butte against each other. Suggestions?
#27, dvdbglw, United States, 6 August 2009. Reply to this.
Hi there
Great article, I have learnt the basics now but having a slight problem with my site with a faux 3 columns, could anyone please have a look at my one and see what I'm doing wrong??
http://css-tricks.com/forums/viewtopic.php?f=2&t=4537
Thanks in advance
CHEERS :)
#28, Danny Maireroa, Australia, 22 September 2009. Reply to this.