CSS vs. Tables: Maybe the design is to blame?

Posted

There's been some backlash lately against CSS, and some of it seems so well reasoned that even I find myself wondering if tables are really so bad after all. From giveupandusetables.com, which says the maximum time to spend before abandoning CSS is 47 minutes, to the well-illustrated blog post by Ron Garret, the general argument is that CSS isn't up to the task of faithfully reproducing elaborate designs cross-browser in an acceptable amount of developer time. In his post about Garret's article, Dion Almaer at Ajaxian opines:

CSS purist[s] may poo poo him and say "he is just dumb and doesn't REALLY know CSS." The problem though is that most developers run into exactly the pain that he describes. We’ve all been there. It drives you nuts and when frustrated what do you do? You fluster about and change CSS like a mad man until it kinda looks right. And, you never learn what the real problem was, and thus destined to make the same mistake again.
It seems that while developers are thinking about sacrificing web standards for the perceived simplicity of tables, the viability of the design rarely enters the debate, and that's a shame. In my experience, some of the most difficult designs to produce using CSS were fundamentally flawed from the get-go, created by designers who failed to grasp that the web is not like print. The web is not like print. In print, designers have near-total control over the output, because the number of new "pages" -- items of content -- is limited by the cost of printing. If a print designer wants text vertically centered in a fixed-height column, or two columns that are exactly the same height, or rounded corners with drop shadows on top of gradients, there's no reason they can't have that. The cost of printing is sufficiently high, and print graphics programs are sufficiently sophisticated, that making those design decisions has no impact on the marginal cost of production. On the web, the marginal cost of creating a new page of content can be approximately zero, but to achieve that we must build pages that adapt to unpredictable content and unpredictable users. If we don't, we won't realize the economies of scale that the web has to offer. The tradeoff for that infinitesimally small marginal cost is that the rules have to be different, because the cost of implementing those print-centric design decisions is inordinately high. Instead of sophisticated graphics programs, the web has mere humans to turn PSDs into working pages; instead of content created by experts and pored over by editors, the web has volumes of user-generated content, and the ability to change it on a whim. On the web, equal-height columns will cease to be equal height when the content changes; vertically centered content will outgrow its fixed-height bounds; and rounded corners with drop shadows on gradients can't possibly be worth the cost of producing them. These are not problems with CSS that should be solved with tables. They are, fundamentally, problems with the design. When I talk about this to other developers (and any designers who are willing to give me the time of day after I'm done pointing out how costly their design will be to produce), I make the analogy that it's just as absurd to impose these print-centric design conventions on the web as it would be to use holograms for every picture in a magazine. Sure, you can, but that doesn't mean you should. So what's a web developer to do? When designs reach the desk of the CSS developer, more often than not they've been through so many rounds of review, revision, and approval -- by people far-removed from the realities of the web -- that the developer has little choice but to toil away at reproducing them faithfully. The best defense may be a good offense, which is to say, the burden is on you, dear developer, to educate the misguided designers. Here are some tactics I've used:
  • Impose yourself early in the process, insisting on wireframes and information architecture documents (even if they're just sketches and an outline). Identify potential problems early on, but don't become a naysayer -- make sure you offer ideas, not just criticism.
  • Push back -- gently but firmly -- on design decisions that have the potential to cause problems down the road. Ask lots of "what if" questions and insist on answers.
  • Be honest about how long it will take you to accomplish a design -- with yourself and with your boss or client -- and identify opportunities to make cost-saving changes to the specifics of the design without changing its spirit.
  • Have examples at the ready of similar problems solved in more web-centric ways. The Yahoo! Design Patterns Library can be an excellent resource for this, but look also to other sites in your industry or genre.
The burden's also on you to get better at CSS. I am lucky in that, when I first started playing around with web production, I was a little intimidated by tables. A background in print production steeped in templates and stylesheets made tables seem awkward and strange to me; CSS, temperamental as it was, at least bore some resemblance to the cascading style sheets of print production programs like Quark and InDesign. These days, it's rarer and rarer (but not unheard of) that I find myself beating my head against the wall over a CSS problem. I've learned HTML and CSS patterns that I reuse often, and I've learned to spot -- and speak up about -- design-induced ratholes. If you're finding yourself sucked in by the latest round of CSS vs. tables debate, take heart, stand firm, and reconsider the source of your frustration.

Useful things:

Posted

18 comments

Feb 14, 2009
Paul Battley said...
You're absolutely right. I've been thinking the same thing for a while, and I've been trying to come up with some designer guidelines – a checklist, really – that test the viability of a design. Not limiting the vertical is a big one, but there are other things that are very difficult to achieve in CSS (at least, in the subset that IE6 supports).

Design works best when it works with the medium, not against it; the challenge is to work out what the medium is and to communicate this; to make sure that its constraints are understood before you get to the stage of 'make it look exactly like this'. It needs engagement rather than just throwing designs over a wall. It also needs imagination: what will this design look like when the title is twenty words long rather than three?

I'll definitely be using your apposite expression, 'the marginal cost of creating a new page of content can be approximately zero'.

Feb 14, 2009
Jack said...
Yes, the web is not print. Why are we using print based standards when more often than not we want to build user interfaces, not magazines?

Html/css in its current form is broken and needs to change, and it needs to change fast. Otherwise we risk it being supplanted by other proprietory systems such as flash and silverlight.

Feb 14, 2009
Rachel Nabors said...
I often hear people say CSS is hard, why can't I just use tables, they don't really hurt anything, and so on.

I have found that most of the people who complain usually have only a cursory knowledge of how the Internet works now (compared to how it worked in 1998, when "meta keywords" counted). That or they've simply not studied CSS. Maybe they looked at some code examples and went from there without looking at any good books or reading any good blogs on the topic (for which laziness is to blame, surely, and I can't click two links without hitting one or the other).

I also hear these complaints coming from people who have their own small sites that they built 5-10 years ago using a WYSIWYG, feeling shortchanged that the Web, its users, its search engines, its traffic, are moving on ahead of them. This is like someone sitting at their home computer sad that they can't print their memoirs from Word directly into a bound book on their desk. It takes a professional. Always has, always will, and that is how it should be.

If the Internet has shown us anything, it's that amateurs have to be curtailed and reined in. You can't slow the pace of progress because some people don't want to study or ask questions.

CSS has problems, yes, and we're using hacks to make it work at times, true, but tables were nothing more than hacks even back in their heyday, so calling CSS-based design ineffective because it uses hacks is the pot calling the kettle black.

But we are working toward a hack-free day when anyone can go online, even the blind. We're going where tables couldn't. And I think tables would have wanted it that way.

Let them go. Let them go...

Feb 14, 2009
Edward J. Stembler said...
I'm one of those (former) CSS purists who switched back to tables. I was spending way to much time trying to get everything working across the board. And damn IE6 and Safari! Though Safari is much better these days. How much time of mine was taken away from the actual goal and business task of developing a web application? Web development as a whole aggravates me. Silverlight + XAML was a nice reprieve, though I cannot use it for all projects and it's still gestating.
Feb 14, 2009
Dave said...
If tables can do it, so can CSS. And if it takes you 47 minutes to figure it out with CSS, you don't understand CSS. I'm not a CSS evangelist (yeah, right), but I'm learning more and more how powerful and easy to use CSS is. Combine it with jQuery, and nothing is impossible. The level of control a print designer gets, I get with web, because I understand my tools. Take a look at my site, for example. Pure CSS, not a table to be found, and yet it's still designed to handle unpredictable content. Looks like a table, seems to behave like a table, but it's just a bit of div trickery... divery, I suppose. Took me about 20 minutes to scrap the table that was previously there, and replace it with this. Works perfectly in IE, too. There's only one instance where tables are superior to CSS, and that's for displaying tabular data... that's what tables are meant for. If it isn't tabular data, CSS is the right tool for the job.
Feb 14, 2009
Jeroen Goulooze said...
And now we have gone into the name calling: people who do want to use tables are bad designers and they probably are too stupid to understand css and eat babies as well. The thing is that in theory everything is hunky dory but in practice it is not and I do not blame people if they say "If browsers do not play nice, I do not have to play nice". In ten years things will be different, hopefully. But you can never be sure because the last thing I heard is that explorer 6 is going to be used on windows powered mobiles so that is going to be deja vue all over again.
Feb 14, 2009
Bret B said...
The issue isn't about design, or about whether CSS or tables are better. The issue is about technology adapting to what humans want. Your article, while informational, adopts the position that humans should adapt to the technology. This shouldn't be the case.

Humans should be able to do with technology what they will, not the other way around. If there is a problem with doing what we want, the technology should adapt, not the other way around. Yes, the web isn't print, and print isn't the web. However, if I want rounded corners, for whatever reason, shouldn't I be able to have them? My desires for some design element should trump the (in)ability of the current technology to accommodate me.

Feb 14, 2009
Rebecca said...
@Bret: I think it's wrong-headed to say that technology should bend to our will. We can't fly our cars and we can't create three-dimensional objects on two-dimensional pages. Every medium has its limitations, as well as its opportunities. You *can* ignore those limitations, but you do so at your peril -- the cost of ignoring them will be high, and may cancel out the opportunities (such as the zero marginal cost) of the medium.

The web is such a technological advance from anything we've had before that I think it's tempting to say "I should be able to have whatever I want! Computers are magic!", but it's a medium just like any other. Think about the limitations of print, of film, of sound, and think about how long it's taken to whittle down those limitations. Somehow I doubt the director of Casablanca stomped his feet about the fact he couldn't make the movie in color.

Web developers are working every day at overcoming some of the existing limitations of the web -- see sliding doors and all sorts of other CSS patterns that have arisen in the past several years. In the meantime, designers would do well not to stop pushing the limits, but to embrace the input of the developers who will have to produce their design and realize that the vast opportunities of the web come with some practical limitations.

Feb 14, 2009
Blog Critic said...
"it seems that while developers are thinking about sacrificing web standards for the perceived simplicity of tables"

Don't be a fool. Tables are part of the standard.

Feb 14, 2009
Rebecca said...
@Blog Critic: Tables are part of the standard, yes, but the standard says: "[A]uthors should not use table-related elements in the document language, but should apply the CSS to the relevant structural elements to achieve the desired layout."
Feb 15, 2009
olav said...
The article conflates the use of tables with design that are not suitable for the web. Actually CSS using e.g. absolute positioning is much less flexible and web-friendly than tables.

This is why tables seem strange when coming from a DTP background: There is no need for that kind of adjustable grids when working with paper, since the paper won't change dimensions. The web is different.

The adjustable-grid model of tables is also included in CSS through the display:table property, but that is not supported by Internet Explorer. This is the reason many choose to use markup tables - to get a more flexible design better suited for the web. Due to the limitations of Internet Explorer we have to use presentational markup to achieve this.

Feb 15, 2009
Nicole Sullivan said...
Poetry also has limitations; number of syllables, rhyming, etc. That's what makes it extraordinary and beautiful.

I like your take on design and its impact on dev time. As F2Es become more senior, I hope they will be included in the decision making process more. Then we can have more input into the design earlier.

-- Stubbornella

Feb 17, 2009
Colin said...
I'm all for getting better at CSS. In fact, I much prefer it to tables. Hadn't touched tables in ages and found myself back in the deep end when I had to pull together a fairly complicated layout for an email marketing campaign using Campaign Monitor.

Unfortunately, a table-based layout is still the only layout that displays correctly across all mail applications...unless I'm mistaken?

Apr 01, 2009
Sam said...
Excellent piece Rebecca. I had issues with tables back then, never the less I was for a while reluctant to switch to tableless layout. As made the move I noticed the benefit - pages improved in many ways - not least loading time but also marking them up is far easier. Since table layout are easy to botch up missing a td or tr or having to many td in a tr (had troubles with background images too & would be really slow to animate pages via js due to repaint/reflow)

As Stubbornella explains you have to work within the realm of each medium. As they say in Python Simple is batter than complex, complex is btter than ecomplicated. Mark up of tableless layouts is simple. Css is complex but table based layouts are overly complicated. I imagine that if they remade Casablanca in colour it would be a flop, if they colorized it it would lose its magic. The way forward is to make css that need not be added (in most cases - and when it must be extended its clear how to do so) this eases the maintence of content and templates too.

Don't build for the past but prepare for the future, whilst working within the present. By which I mean sure IE6 is a pain - its a dying breed. IE7 is a headache but will soon be a dying breed too & IE8 is much better. Compromises will always have to be made we should learn which ones to make and where - I imagine that print designer have to make them also (butI don't know enough about print to say whay they would be)

Jun 24, 2009
James said...
After much thought and consideration of the matter at hand I have determined...your all full of it.

What few seem to realize is that no standard or technology is perfect and we should only play the cards we have in our hand (that means not betting on things that may never happen).

So how do I see it? Play to your strengths not your weaknesses. No matter how many fans of CSS will tell you that CSS is a one-shoe-fits-all solution, it isn't.

A reasonable developer will look at both CSS and Tables and know where to use each and they *will* use both if they are smart.

And before anyone pipes in with "Yeah your right. a good dev will know what each is for. Tables are for *tabular data* and CSS is for nice layouts"...

Let me remind you standards (not the W3C kind, but the 2/3rds majority kind) determine what a hack is and isn't a hack. This is unrelated but look at the C language, it's one massive hack atop Assembly, and C++ is one massive hack atop C.

It is not committees, or corporate giants that set standards it is the people that utilize the inherent technology. Use dictates purpose. At one time tables where for tabular data. Now many, many people use them for layouts. There purpose is now for layouts.

Dec 03, 2009
Miro Keller said...
@Rebecca Let me start by saying that I enjoyed reading your post, and I hope someone gets to read this comment even if the post is several months old.

"These are not problems with CSS that should be solved with tables. They are, fundamentally, problems with the design."

I think you are both wrong and right at the same time. They are not problems that should be solved with tables. I agree wholeheartedly. But they are not problems with the design at all. The problem is that CSS is deeply flawed.

You say that you cannot have rounded corners, with gradients and drop shadows on the web. I say, why shouldn't you? It is one thing that it is impractical because of the limitations of CSS (creating images, wrapper div's etc), and the other to say that this is something that is not possible on the web.

CSS is the best we have right now, but it is not at all the one size fits them all. At the time it was created, they actually never intended it to be used for layout. The first spec said somewhat along the lines of "make those li elements green", and similarly simple tasks. Those simple tasks they accomplished really well, but designers want to create designs and layouts that push the limits of the language.

Why can't you vertical center something? Or have equal height columns? Or gradients, rounded-corners, effects (shadow, glow, etc), transfer modes, doing something like "100% - 50px"? I could go on... those are not limited by the medium, just by the specifics of the technology.

For those who say that those banging their heads against the wall while trying to get CSS to behave should learn more CSS, my response is that a language should be designed to be easy to use, not criptic and hacky. And that notion of it being good if it is complicated because of amateurs with poor taste is sheer nonsense: you will always have amateurs, but if the language is harder, even good designers will be limited.

Finally, every existing technology has its problems. HTML+CSS is no panacea, and neither is Flash. I wish for something completely new to replace them, to allow us to do all that we are longing for.

Cheers
Miro

Feb 04, 2010
diseño web said...
The one that continues using tables is because it does not dominate or does not know CSS. To design in CSS is far better, by the subject of order, maintenance, accessibility, navigability and thousand reasons more.
Aug 27, 2010
Wayne M liked this post.

Leave a comment...