Sliding Faux Columns

Published 20 years, 3 months past

A while back, in the summary to his article “Throwing Tables Out The Window“, Doug asserted:

There’s no longer any reason to use tables for layout, nor is there reason to maintain multiple versions of a site solely for different desktop browsers. Throw the tables out first. Trust us, they’re not needed anymore.

At the time, I remember thinking that I agreed with him for about 90% of design cases, but that there was that nagging 10% that still seemed to require tables.  That would be the cases where elements have to have the same visual height, regardless of their content height, and the layout is not fixed-width.  (Fixed-width cases can be easily handled using Dan Cederholm‘s Faux Columns.)  The classic example is a liquid two-column layout containing a sidebar and main-content column, where the sidebar has a different background than the main content, and that background has to be as tall as the main content—and, conversely, the main content’s background has to be as tall as the sidebar’s if the sidebar is taller.  There are ways to get this to happen using non-table markup, but it usually involves at least as much markup as using a simple table, and is less stable in older (NN4-era) browsers.  If  you go to three columns, all of which must match each other’s heights, then things get really wacky.

So I eventually got around to asking Doug about those cases, and it turned out he’d been mulling an idea similar to one I’d had but never pursued.  We tossed messages back and forth, hammering away at his idea, and eventually christened it ‘Sliding Faux Columns’.  Doug writes about this technique his recent post, Liquid Bleach.  Here’s the basic idea in a nutshell, quoted from Doug’s post:

The trick is to create an ultra-wide background image (or two images for 3-column layouts, thus the Sliding-Doors-nature of the technique). The image is partially opaque, and partially transparent. It gets tiled vertically inside the parent container, just like Dan’s Faux Columns technique. The opaque portion of the image should match percentages of the column it helps create, so that it can be positioned with an identical background-position value. This allows the transition from opaque to transparent to become the axis point for the background’s position.

Amazingly, the technique appears to work in IE5/Win and later.  IE5/Mac has some problems, and while the problems were vaguely familiar ones we never did manage to figure out how to work around them.  More recent browsers, like Safari and the Gecko family, seem to handle the technique just fine.

While we were working on the concept, I threw together some test cases.  They aren’t up to the usual css/edge standards, which is why you won’t find a link on the main css/edge page.  I’m putting them out in public because they might be interesting to anyone who wants to play with a boiled-down version of the technique.  Note that the super-wide images are only needed if you’re trying to fill a color or pattern into the background of the column(s).  If you just need a vertical separator, then an image as wide as the separator (say, one pixel) is all you need.  The CSS works out to be exactly the same in either case.  It’s just a difference of a 3000-pixel-wide background image versus a one- or two-pixel-wide image.

The markup isn’t exactly pretty: it requires a couple of wrapper divs just to set up the column backgrounds/separators.  This isn’t more markup-heavy than a table constructed to serve the same layout goals, but then it isn’t a whole lot less heavy either.  Personally, I remain agnostic on which is a better approach.  Bending a table to layout purposes isn’t clean, but to my eye, neither is constructing a couple of 3000-pixel background images just to get the effect a simple three-cell table can allow.  You’re hacking your way around limitations in CSS either way you go.

This brings me to a question I often encounter: “Why doesn’t CSS have a grid layout capability?”  It does: styled tables.  That’s pretty much it, but it’s there.  Until CSS gets grid-layout functionality that isn’t table-centric—the only “pure CSS” grid layout approach being to apply table-related display values to non-table elements, and boy, does that ever make a lot of sense—and that functionality is widely supported, then tables are the best grid-based layout system available in the (X)HTML+CSS space.

Before the purists warm up their flamethrowers and the CSS haters start to crow that I’ve done a Bush-style flip-flop, note that I said it’s the only grid layout system available.  The designs that absolutely require such a system are that 10% I was talking about earlier.  Most other designs don’t need a grid system, and so don’t need tables for layout.  The current Wired News design is one, the new Chevrolet site is another, and meyerweb is still a third.

As Doug has proven with Sliding Faux Columns, it’s possible to cover a good portion of those sites that would normally need a grid system without table markup.  That’s certainly interesting, and in one sense it’s quite useful in that it details the hoops through which one has to jump to make this sort of thing happen with CSS.  When you get right down to it, though, I’m feeling very ambivalent about which I’d prefer to use: Sliding Faux Columns or a simple table to set up the columns.  I suspect probably the latter, in my personal case.  The great thing is that now we have a choice for those kinds of designs.

For the small percentage of designs that really do require a full grid system, though—and I really have seen only a few in all my years of surfing the Web—tables are your only realistic choice.  I wish CSS had addressed that point in years past, so that we’d have some hope of support at present.  It’s always struck me as one of the biggest missed opportunities of CSS.


Comments (12)

  1. Pingback ::

    molly.com » faux tables?

    […] le, he’s redesigned again! You can read Eric’s take on it in his piece, “Sliding Faux Columns.” After reading both articles, I’m far l […]

  2. Pingback ::

    CSS-Technik-News

    […] ing Faux Columns

    Angeregt durch Doug von Stopdesign hat Eric Mayer etwas gebastelt: in Sliding Faux Columns beschreibt er in Analogie zu Faux Columns eine M

  3. Pingback ::

    Randomize - In Search of Tableless HTML

    […] 6d1ed55f2f”>
    In Search of Tableless HTML
    Seriously, if you are going through lengths like these to avoid using the (non-deprecated, I might add) (X)HTM […]

  4. Pingback ::

    a-css » Sliding Faux Columns

    […] nager System) WordPress –>

    Sliding Faux Columns
    07/09/04 Eric Meyer parlad’una combinaci

  5. Pingback ::

    Coulisses d’un redesign (3): sIFR, IE7, navigation et problèmes CSS (Almaren)

    […] echnique de mise en page, telle les Faux Columns de Dan Cederholm, ou peut-être même les Sliding Faux Columns suggérés par Eric Meyer. Pour les plus curieux d&#8 […]

  6. Pingback ::

    The Naked Green » Design of SimpleBits

    […] d sidebar consistent. I’ve used the “Sliding Faux Columns” approach (1, 2, 3) in achieving a flexible, […]

  7. Pingback ::

    Max Design - standards based web design, development and training » Blog Archive » Some links for light reading (13/9/04)

    […] ss check W3C uses presentational markup – oh the horror The perversion of Web Standards Sliding Faux Columns
    Posted in light reading

    […]

  8. Pingback ::

    vicentjorda.com » Galería de Diseños (Layout Gala)

    […] columns [EN]. Estos diseños se pueden complementar con las técnicas Faux Columns [EN] y Sliding Faux Columns [EN] que sirven para poder aplicar un color de rellen […]

  9. Pingback ::

    Keeping your Balance with ECMAScript - The Web Standards Project

    […] wsers need a bit of help doing the right thing. Is Paul’s method any better than the […]

  10. Pingback ::

    Выравнивание высоты контейнеров при верстке DIVами | Вебмастеру посвящается...

    […] Данный вариант хорошо подходит для страниц с фиксированной шириной. Его также его можно использовать и для «резиновой» верстки с применением метода адаптированного Дугласом Бауменом и Эриком Майером Sliding Faux Columns. […]

  11. Pingback ::

    Joomla 1.0 Tutorial – Make Custom Template « Blakesabbath's Blog

    […] Notice that the side columns do not reach their footer. This is because they only extend as far as their content, where the space is red on the left and white on the right, they don’t exist. If we have a template that has a white background for all three columns, this is no problem. We will use this approach and will have boxes round the modules. If equal height columns are desired that are colored, or have boxes, you must use a background image that will tile vertically. This technique is called “Faux Columns” and is described by Douglas Bowman and Eric Meyer. […]

  12. Pingback ::

    SimpleBits / Winterfresh

    […] header and sidebar consistent. I’ve used the “Sliding Faux Columns” approach (1, 2, 3) in achieving a flexible, yet full-length […]