Skip to page content or skip to Accesskey List.
Search evolt.org
evolt.org login: or register

Work

Main Page Content

Tables or CSS: Choosing a layout

Rated 4.24 (Ratings: 18) (Add your rating)

Log in to add a comment
(27 comments so far)

Want more?

 
Picture of csaila

Craig Saila

Member info | Full bio

User since: August 26, 1999

Last login: February 04, 2009

Articles written: 6

Dave Winer walked into a long-simmering debate when he recently asked what's so important about tableless layout. The kinds of passionate responses he received have been regularly heard throughout the web design community—including places like evolt.org's own lists.

Not ready for prime time?

One of the common arguments against CSS-based design is that reality hasn't caught up with the technology's benefits.

Although no popular web browsers fully support CSS2 yet, many of the latest versions (Netscape, IE5+, Opera, and OmniWeb among others) have excellent support for CSS1 and strong support for CSS2. Even better, the public seems to be adopting these new browsers relatively quickly.

A year ago, more than one-quarter of the surfing population used browsers with poor CSS support (including IE 4). Now less than 12 percent do—putting support of CSS-based design at the same level as JavaScript and Java.

Three reasons why

Advocates of tableless design have their own pet reasons as to why style sheets are better (“it's faster”, “there's better design control”, “it's the right thing to do”), but three common reasons are presented again and again:

  1. Semantics: The HTML table was conceived as a means to display tabular data. Using tables for layout was mentioned in HTML 3.2, but only to acknowledge existing use—the concept didn't appear in the original RFC. In future recommendations, the W3C said style sheets, not tables, should be used for layout. Using tables for layouts is like wearing dress shoes jogging—both work, but they're the wrong tools for the job.
  2. Accessibility: Screen readers and text browsers struggle to read table-based layouts. In fact, the W3C, in its Web Content Accessibility Guidelines, explicitly says “[d]o not use tables for layout...” A tableless-layout designed using CSS can present the most appropriate, and usable design for each user agent—be it a cell phone, a screen reader, a TV-based browser, or a browser running on a desktop computer.
  3. Efficiency: For both the site developer and the reader, a CSS-based design offers a degree of flexibility nearly impossible in restrictive table-based layouts. Not only can developers quickly and easily redesign an entire site by modifying one file, they can also present alternate designs for the reader. Separating content from the detailed structure table-based layouts provide, has the added benefit of future compatibility and portability.

Think about the future

Given the direction of current browser development and of the W3C itself, CSS-based design looks to become the de facto method of web design. Before switching to a tableless design, though, designers should consider the site's audience and goals (as they do whenever using anything other than pure HTML):

  • Do most of the audience's browsers have good CSS support? If 30 percent of the audience uses Netscape 4.x, for example, switching may not be the best idea right now.
  • Can CSS be implemented efficiently through all or part of the site? If all of the site cannot be changed immediately, small sections could benefit from CSS.
  • Can there be two or more versions of the site? Some sites offer the previous tabled layout to older browsers, and the CSS version to the newer ones.
  • Will the redesign by unveiled now, in six-months, or a year? The longer the planned roll-out, the more likely the audience will better support a CSS-based design.
  • Is/will the site be available in multiple formats and media? If so, the benefits of CSS far outweigh the negatives.

Even if a tableless design may not be suitable for one site today, it will be for a growing number of others now and in the future.

Craig Saila has been working the Web since 1996, and has redesigned some of North America's top news organizations including msnbc.com and The Globe and Mail. Throughout his work, he’s divided his time between client-side development and online journalism — dual interests which are apparent at his site, saila.com.

Finally the raw stats and cold logic!

Submitted by javabandito on March 1, 2002 - 10:07.

I consider my experience in WebDev relatively short-lived, but I have in a matter of six months been confronted by standards and looking forward in my continuing education regarding these matters. On my first real website, which has not gone live yet, I have been confronted with audience, standards support and download efficiency. Now I feel armed with the logic and advice of Jakob Nielsen as well as the aide of your concise, well-written, informative article. I think to me self... can I apply styles liberally while creating a second webpage that deviates not far from the original design, and still reach the my total audience? Methinks so.

login or register to post comments

Great overview.

Submitted by neoliminal on March 1, 2002 - 11:41.

I very much enjoyed reading your thoughts on the subject of style sheets and browser compatability. Too often we get caught up in the furvor of standards or browser preference without taking the step back to consider the overall picture.

You've taken that step back and it's clear to me that I can start using CSS with more confidence.

thanks!

login or register to post comments

More issues

Submitted by noahlazar on March 1, 2002 - 11:59.

Although I would love to make the switch to CSS layout instead of tables, there are too many issues involved to make it successful.

First there is the maintenance problem. As an HTML and CSS expert, I typically write clean, accessible code. Most clients, however, will simply throw the sites into editors like FrontPage 2000 or Dreamweaver 3. Even if the page shell has a CSS layout, many editors will not recognize it, or possibly even destroy it.

Secondly, most new browsers still just don't have it right. I applaud the Web Standards Project for their effort in getting people to upgrade, but it's not enough. IE 5 renders pages differently than IE 6, and it's a whole different matter with Netscape 6.2 and Opera 6. With CSS layout, the browsers all have their quirks that you need to hack through. Same goes for writing compatible DHTML for multiple browsers. With tables, every browser since Mosaic can pretty much get the layout just right. That's a big plus for usability and layout design. But it's a tradeoff since it hinders the accessibility for non-visual and older browsers.

A big issue, as Craig mentioned, is to determine the site's audience. For government, education, or non-profits, the percentage of Netscape 4.x users is much higher. Many government agencies have standardized on Netscape 4, so your designs must work perfectly for them. Even if your client's CEO uses Netscape 3, they will want the design that matched your comps on their monitor — not a column-less list of content.

For internal or controlled-audience sites that you has a CMS system or knowledgable people to maintain it, go for all CSS positioning. But for the mass-internet audience, it's probably best to stick with CSS for the fonts and leave positioning to the tables.

...for now.

login or register to post comments

Right on target

Submitted by wb38 on March 1, 2002 - 14:46.

I, too, struggle with finding the right balance between practical reality (using tables for layout) and supporting emerging standards (pure CSS). At the moment, I use a combination of the two methods, and will probably continue to do so for some time, though I have been shifting more toward CSS as support gets better.

I think it's important to remember that, even though the CSS recommendation has been "on the table" for a good many years, it is still an emerging method that will not be fully implemented for several more years.

This article was refreshingly pragmatic, because quite frankly I am growing weary of the implication that "separating presentation from structure" is the only morally right thing to do. It's not a moral issue: it's a practical issue. Yes, it would be great if we could actually use pure CSS for formatting—here and now—and have to make no compromises. But that's not the reality; reality is much more complex. And if you really think about it, how can presentation and structure truly, really truly, be separated from each other anyway? In many ways, they are one and the same.

login or register to post comments

One and the same

Submitted by wb38 on March 1, 2002 - 16:39.

Perhaps this is straying off the topic a bit, but I felt I should explain that last comment: that if you really think about it, presentation and structure are in many ways one and the same.

What I mean is: simply putting styling and formatting specifications in a separate document does not mean the structural markup document and the styling document are independent of each other. Quite the contrary: they are inextricably linked, unless you have a very low opinion of art, design, style, and visual presentation (then you wouldn't even bother with a style sheet!). The style ("design") is chosen specifically for the content. Conversely, the content would be much less readable/understandable or have little impact on a human being without the design. Therefore, I believe it's safe to say that if we are strong web designers and developers, we cannot logically support only one orientation or the other. Bringing this argument back to "Tables or CSS," this means we need to continue using tables so far as it aids purposeful design (in those areas where CSS now lacks), and continue to use more and more CSS where it can aid purposeful design as well as cleaner markup. Maybe we'll eventually get to one system of markup, but that doesn't mean the design/markup balance will become a non-issue. No, they will always be working together for the purpose of articulating content and ideas in a meaningful way to people looking at a screen.

login or register to post comments

Exactly

Submitted by noahlazar on March 1, 2002 - 16:52.

You hit it on the needle. Tables vs CSS is just a technology issue behind the big user-experience picture. Why do HTML e-mails have more readers then plain text? Because the design and interface are created to enhance the usability.

Ideally, CSS allows for the separation AND enhancement of the user experience. But until the technology catches up, just make your site work for as many people as possible.

login or register to post comments

hot topic

Submitted by StOne on March 2, 2002 - 02:40.

A recent article and thread on Acts Of Volition (An open letter to the web design community: Why should I redesign my site with Cascading Style Sheets?) might also be of interest. The topic seems to be generating a great deal of discussion.

login or register to post comments

Reason number two is out of context.

Submitted by aardvark on March 2, 2002 - 15:02.

Just wanted to note that above you say the W3C says "Do not use tables for layout..." This only the first part of the sentence. The full sentence reads: "5.3 Do not use tables for layout unless the table makes sense when linearized [emphasis added]. Otherwise, if the table does not make sense, provide an alternative equivalent (which may be a linearized version)."

In fact, you can use tables for layout and still meet Priority 1, 2, and 3 checkpoints for the Web Content Accessibility Guidelines 1.0.

I've pasted in Guideline 5 below, but you can go read the full guideline in context and with links if you prefer (I know I do).

Guideline 5. Create tables that transform gracefully.

  1. For data tables, identify row and column headers. [Priority 1] (Checkpoint 5.1)
  2. For data tables that have two or more logical levels of row or column headers, use markup to associate data cells and header cells. [Priority 1] (Checkpoint 5.2)
  3. Do not use tables for layout unless the table makes sense when linearized. Otherwise, if the table does not make sense, provide an alternative equivalent (which may be a linearized version). [Priority 2]
  4. If a table is used for layout, do not use any structural markup for the purpose of visual formatting. [Priority 2] (Checkpoint 5.4)
  5. Provide summaries for tables. [Priority 3] (Checkpoint 5.5)
  6. Provide abbreviations for header labels. [Priority 3] (Checkpoint 5.6)

login or register to post comments

Linearized table layouts

Submitted by csaila on March 2, 2002 - 15:28.

Thanks, aardvark, for pointing that important point out (in the process of the edits the title attribute was apparently removed that explained the quote in context).

The quote was originally shortened in the article because its scope could not include a discussion of the difference between linearized and traditional table layouts (the vast majority of Web sites using table-based layouts -- include one version of my own -- do not present the content in linearized fashion).

login or register to post comments

Linearized??

Submitted by carlitos on March 4, 2002 - 14:02.

Excuse my lack-of-knowledge but what does "linearized" layout mean?

Many thanks,

Carlos

login or register to post comments

Linearized Layout

Submitted by noahlazar on March 4, 2002 - 14:43.

Linearized layout is basically an HTML page without columns. Consider what happens to pages when read by screen readers (such as JAWS) or text-only browsers (LYNX). The pages are read line by line.

While visual and modern browsers would se a three column page using just <div> tags as:

Left             Center              Right

Older and non-visual browsers would return:

Left Column ...
Center Column ...
Right Column ...

With tables instead of div tags, the accessible browsers should interpret the content the same. But tables would also allow older (or non-CSS2) visual browsers to see the columns as well.

Hope that helps!

login or register to post comments

Nice article

Submitted by Spyder on March 7, 2002 - 04:09.

Thanks for sharing your thoughts and information on this topic - I enjoyed reading about it and it makes me even more enthusiastic about the future of web design. I have recently built a site using only CSS and I really love the flexibility. Since it is a personal site, I really don't mind what happens to netscape users :-p

login or register to post comments

Good ole days

Submitted by noahlazar on March 7, 2002 - 16:43.

Hey, Netscape 4 was the greatest browser ever made! ....well at least in 1997. I have less beef with those people then the ones who still use Netscape 3.

If you don't know it's broken, why fix it?

login or register to post comments

check your audience

Submitted by jessamyn on March 11, 2002 - 15:25.

I'm surprised no one has really mentioned the target audience of the website as an important factor. A website I maintain is read frequently by people in library settings. For whatever reason [another whole issue] these people are often using older versions of browsers. I have about 20-25% of my readers who use Netscape 4.7. While I may think these folks are chuckleheaded, if I want them to be able to read my website, and have nice feelings about it, I should try to design for them.

While I respect the Web Standards folks and think that some people should really start forcing the issue, I've been keeping to a tabled layout [with CSS for text formatting and tables for mostly columnar formatting] until I see the Netscape 4.7 users drop below 15% or so.

> Why do HTML e-mails have more readers then plain text?

I always thought this was because Outlook users don't know how to turn that feature off.....

login or register to post comments

Good, bad and really ugly..

Submitted by GlobalMind on March 14, 2002 - 12:56.

Greetings.

I have been playing with HTML coding since we discovered Mosaic .96B when in college. While I certainly am not a professional graphic designer or web designer, I take pride in what I do - and that my own personal website is presented well.

I am currently in the process of a total redesign of my site, and thought perhaps it was time to give this CSS stuff a try. In the past I had layed off of it because I really thought it was not ready for wide scale use. So, I bought a book and dove in. What I am finding is that I really enjoy coding with CSS, and that my HTML pages are much cleaner, load faster and I have great control of where things are placed on screen.

I completed a design in full CSS (no tables whatsoever) for my homepage, and was quite pleased with the result...that is until I started to test in other browsers than IE 5.5 Win. I downloaded Opera 6.01 and found it liked to play with my padding settings nicely...so I changed the code and resolved that. The page looks as good now in Opera 6.01 as it does in IE5.5.

Netscape 4.79 however is a totally different issue. Support for all of the CSS I am using quite frankly stinks to high heaven. So, I am in a quandry as to whether I should design with tables and CSS to provide backwards compatibility or do I just redirect them to the Web Standards Project upgrade page.

I am really ticked that I have this great design and I have to deal with all these backlevel browsers. However, this is something we've been dealing with from day one of web design. Frankly I am extremely annoyed at having to deal with it.

Many recent surveys of web browser use have indicated that the Netscape 4.x user base is extremely small today. So, I am really prepared to just say the heck with it and leave things as they are. My overriding thought is that you simply cannot support everything forever. Are we to not use technology a year from now just because there might be some person on the dark side of the moon using Netscape 4? Extending that logic, should you expect to run Office XP on a Win 3.11 machine? Or connect your iPod to a Mac Classic?

Progress hurts sometimes, and there really are very few reasons why folks can't upgrade their browser to something newer. Heck I am half tempted to say, look if you don't have the bandwidth or whatever to download it --- I'll just put a CD together with Netscape 6, IE 6, and Opera 6 on it and you choose.

Anyway, stepping off of the soapbox -- K.

login or register to post comments

good, bad, ugly, and me...

Submitted by aardvark on March 14, 2002 - 13:33.

Deciding to re-code to tables or not is a personal decision. Ok, it's really a decision that should be made by the needs of the users weighed with the needs of the site (and sometimes weighed with what the client demands).

That being said, don't just redirect the user to the WaSP page. Let them get to the content. Don't throw that barrier up. Use @import, for example, to hide all your CSS from NN4.x, allowing them to still see the content at least. If you kick them out, they won't be coming back. If you show plain vanilla, and least they can judge the value of the site based on content.

As for reasons not to upgrade, it has a lot less to do with personal preference than you might think. Locally, a lot of inner-city kids who don't have computers at home and are in impoverished schools can only get access to old 486 machines running IE3 or NN4.x. They can't even partake in a local art project designed for kids because it requires IE5 and higher. Keep those exceptions in mind when deciding to kick users of older browsers out, or when deriding them (not that you are) for using such old technology.

login or register to post comments

Good, bad and ugly...take two...

Submitted by GlobalMind on March 19, 2002 - 08:32.

aardvark....

It very well may be that I will use @import or continue to use tables for some of my layout of the new site.

My big peeve is unfortunately something that will seemingly never end. It is considered taboo in the web world to ask a user to upgrade their browser, for many reasons -- including those you mention. However of course in the desktop computing world, it is perfectly normal to have to upgrade your PC OS to take advantage of new software etc.

Unfortunately, like I said -- this is something which I don't think will ever end, but nonetheless I am annoyed by it.

I currently have IE 5.5, Opera 6 and NS 4.79 on my PC at home and will test to those levels as well as validate my code to W3C. Other than that, I don't have an easy way to really test IE 3 or earlier Netscape browsers. So, in the end some users may end up in the same boat. The problem ends with despite all the stats we have on browser usage, there will always be someone who has a problem because their browser is just too old to work. Do I then redesign for that person? The idea of usability seems to say, Yes you do -- and there never is a point that you say -- Sorry, upgrade.

So, I take what I can from my exploration of CSS and know that it has given me a much better understanding of what is possible and now I must tailor that to what is feasible.

K.

login or register to post comments

W3 page

Submitted by arnaud on March 20, 2002 - 10:46.

The W3 denounces the utilisation of the tables in a page, for the design... But, the site www.w3.org is composed of a three columns table...

login or register to post comments

Hmm so they do & its now 6months from when yopu po

Submitted by corrs_fan on September 18, 2002 - 17:33.

the bad thing is its now 6 months later & their still doing that. How is the average person supposed to learn by example if theres no example being set :)

login or register to post comments

example to follow

Submitted by Spyder on September 20, 2002 - 02:59.

The W3C should practice what they preach but they also have to be practical and deliver a site that works best for the majority of visitors. If you want good examples to follow, look to webstandards.org, alistapart.com, zeldman.com etc...

login or register to post comments

lack of knowledge

Submitted by asonnenshine on January 22, 2003 - 15:54.

I agree that in an ideal setting, everyone would use table-less layouts. But that's not the reality. More than half my users are on Macs using Netscape 4.x, which as most of you know is the most fickle browser/platform set-ups. My feeling is that many web "designers" whose motto is "to heck with the Netscape users" simply do not have the knowledge or experience to create beautiful layouts using tables. There are many bugs and quirks to be aware of and can only be perfected thru months (or years) of making mistakes. I pride myself on being one of the true hardcore HTML experts that can produce cross-browser, cross-platform compatible layouts (even if it means using techniques that go against web standards). I ALWAYS test my layouts in Netscape 4.79 on a Mac. If it works there, I can be 90% sure it will work on any PC, 4.x browser and up.

login or register to post comments

Cleaner Code

Submitted by noahlazar on January 22, 2003 - 23:13.

I disagree with that last comment. I consider myself an HTML expert with years of experience creating spacer-image laced layout tables that are pixel-perfect in any browser under the sun. The problem is that, as a consultant, most of my sites are maintained by inexperienced admin assistants after I deliver them. Even after adding hundreds of comments and other helpful spacing in the HTML, it is difficult for many people to dig through lines and lines of table code trying to find the correct cells to edit.

The best thing about removing some (not necessarily all) of those layout tables in favor of CSS is that the code is a million times cleaner to read and simpler to maintain. The individual page sizes are greatly reduced, which also has the benefit of speeding up load time for users with slower connections. In my opinion, the trick these days is to find an equal medium between massive nested layout tables and pure CSS pages. Most sites I create now use one simple layout table to control the basic content columns, but all of the element formatting is done with CSS padding, spacing, and borders. Netscape 4 isn't pixel perfect anymore, but pages are still legible, accessible, and honestly, most people won't even notice or complain about the differences.

4.x browsers are over five years old now... as web coders, we need to help get the message out to users and organizations to start upgrading. I deal with Netscape 4 the same way I deal with Windows 98 and MacOS 7.6—they're old systems, so don't expect miracles out of them.

login or register to post comments

I agree with noahlazar

Submitted by asonnenshine on January 22, 2003 - 23:41.

You're right about the maintenance issue... I am currently dealing with a similar situation at work. My preferred solution is to create a simple content management system in order to maintain layout. We don't have PHP/MySQL at work, so I use MacPERL (weak) with flat-files, created in Excel and exported as tab-delimited.

I, personally, have not noticed that table-heavy pages are much larger in file size, although I DO notice that certain browsers/CPUs take longer to render the multiple nested tables.

As for upgrading browsers, that would be ideal. Our I.S. department has more important issues to deal with than upgrading internet browsers ("hey employees shouldn't be net surfing anyway"). Also, I think another large group of our users are university students who don't know much about computers, other than word processing.

Your message is taken well and does encourage me to start thinking about CSS layout techniques. Thanks for the response!

login or register to post comments

I miss Netscape 2

Submitted by noahlazar on January 22, 2003 - 23:57.

Good points—I guess browser upgrades aren't at the top of most IT department's "to do" lists. I just love it when I still see new machines being imaged with Netscape 4 as their default browser.

I agree completly that providing a CMS system, no matter how simple, is best for any site. Unfortunatly, many clients only want (or can afford) static HTML templates. I'm lucky if they let me use server side includes and a little ASP/PHP to help template the site. Then there are the clients who maintain thousand-page sites with FrontPage 2000 (scary, huh?).

login or register to post comments

Another look at Tables vs the CSS debate......

Submitted by desplus on October 21, 2003 - 18:53.

FYI on this Tables vs. CSS debate.......

Tables vs CSS argument - REVISITED...

login or register to post comments

Pixel perfect

Submitted by deejay on March 12, 2007 - 13:42.

I guys, I think it's more easy to deliver a pixel perfect "design to xhtml conversion" when using layers instead of divs. Tables for data output, fine, tables for anything else (except maybe lineair output), pretty outdated... It's clean, it's lean, it's mean :-) semantically correct coding rules, tables are over and done with. I wonder why evolt is not tableless by the way, it's worth the effort. Although i haven't "upgraded" all my old sites either because yes, i tend to get lazy sometimes. Noahlazar: image spaced layouts are so 1998, with css you can do so much more and far more easy. If you sometimes work with a number of overlapping transparant semitransparant layers, you'll know what i am talking about. In addition, you can set width and height attributes to divs, accompanied with a background image and the margin: 10px 10px 10px 10px; attribute is superpowerful. Dirk-Jan

login or register to post comments

A lot better

Submitted by factor on March 14, 2007 - 01:14.

We have recoded all our sites using css for the layout (and for everything except tabular data) and semantically rich markup and I must say that it was a very good move in all aspects. Because of semantics and better code to content ratio the seo results are better, and a lot more easier to achieve a cross-browser consistency, developing for FireFox and adding a few hacks for IE I can say that everything is pixel perfect in all current browsers. And when it comes to accessibility validation, there are a lot less issues. So using css for the layout is not just about meeting the standards, it can make our life easier.

login or register to post comments

The access keys for this page are: ALT (Control on a Mac) plus:

evolt.orgEvolt.org is an all-volunteer resource for web developers made up of a discussion list, a browser archive, and member-submitted articles. This article is the property of its author, please do not redistribute or use elsewhere without checking with the author.