In defence of layout tables


This should not be a defence against a criminal charge. Using layout tables is not a crime. There is no known formal proposal to restrict the use of layout tables, nor to take action against those who use them.

This should really be a defence against slander and libel. People tell lies about layout tables, and here is a response to the most important of those lies. It takes the form of a defence against a criminal charge because that is how too many people see it.

Big Lies

If a lie is repeated enough times it would become widely accepted as truth. 

Attributed to Joseph Goebbels, Hitler's minister of propaganda. Possibly coined by Hitler himself.

An obvious example of a hidden variable:

Across the world, taller children tend to be more knowledgeable than shorter children. Is this "sizeism" or some genetic defect?

Primarily no. The hidden variable is "age". Older children tend to be taller. Older children tend to know more.

Some statements about tables are simply repeated without evidence, and apparently believed. I don't know where these statements originated, nor why people believe them.

One problem is that people don't compare like with like. They will compare the code produced by someone who barely understands HTML with that produced by an expert in both CSS & HTML. Or years-old code with modern code. These are not useful comparisons, because no-one is making the choice between using "tableless layout & CSS" versus "table-layout & HTML3.2 & no-CSS". The differences in such a case are not primarily caused by the method, they are nearly all caused by the skill-level.

The hidden variable in much of the debate about table-layout versus tableless-layout is "authoring skill". No one rolls out of bed in the morning and wonders "should my next page be tableless & use CSS positioning, or be CSS-less & use HTML 3.2 & table-layout?" If you have the skills to develop a tableless-layout web site, you also have the skills to develop one with table-layout that is "Strict" compliant, accessible, efficient, flexible, etc. Someone who is making a mess of table-layout lacks the skills to get close to a plausible tableless-layout site. The consequences of the different methods are "noise level" in comparison.

When you control the "author skill" and "development date", using tableless-layout & table-layout are relatively little different compared with most of the content. They can both be accessible, flexible, efficient, supported across a target-range of browsers, viewable on 240-pixel screens, etc. I suspect an expert in tableless layout could develop a page using a simple table for layout which would be much better in almost all respects than a tableless-layout page developed by a non-expert.


The case

The prosecution's case The table's defence
"Layout tables result in bloated document sizes"


Write out the HTML for a 3-column 1-row table. How big is it? Probably less than 100 bytes larger than an alternative? Even if you put 100 kilobytes of stuff into the cells (columns) of that table, it will still only add 100 bytes to the size of the document.

"But there are reports that rewritten pages are much smaller"

If you take a page written in HTML 3.2 by a novice several years ago, and an expert rewrites it in HTML 4.01 today, of course it will be smaller! (Especially if the expert cuts corners, perhaps by not attempting to have rounded corners). So what?

What matters is: what would be the difference in size if that expert (or you!) wrote 2 versions today in HTML 4.01 Strict, one using layout tables and the other using CSS positioning? Very little indeed.

"Layout tables cause documents to be inaccessible"


Use accessibility technology, such as IBM's "Home Page Reader", to browse a page that uses a simple layout table. Did that table stop it working? (No). In fact, in default mode, did it make any difference? (It may have caused the technology to present the important stuff before the unimportant stuff. Or perhaps not. But it won't result in a page being inaccessible to competent technology). By default it "linearises". Which may be about the same as the tableless-layout content! Table-navigation-mode can add an extra degree of navigation.

Big, complex pages are inherently hard for blind people to navigate. Even when they are tableless-layout pages. The easiest pages are simple, predictable, no surprises (such as new windows), no Flash, perhaps no JavaScript, etc. Those are more important than the table-layout versus tableless-layout issue.

(IBM's "Home Page Reader" was announced in 1998, after the W3C's 1997 statement that layout tables should not be used).

"But not all visually-disabled people have IBM Home Page Reader"

Whose problem is that? I write in English, and not everyone in the world has access to an adequate translator. Whose problem is that? Must I write in lots of languages?

The target is that disabled people should be able to participate in the modern world, supplemented by modern technology where necessary. They should not have to rely on the rest of the world being constrained to old technology & standards, because that will obviously not happen. Use of accessibility technology must keep up-to-date, just as we should be free to ignore remaining users of NN4, if any. We obviously can't require the use of technology that doesn't yet exist, but where it is reasonably available, we can expect it to be used.

I use reading glasses. It would be unreasonable of me to require someone to change their product if I (and others) could easily manage just by using reading glasses.

"Layout tables are inflexible and don't adapt to the user's viewport"

This must surely be the biggest lie of all! It is the opposite of the truth.

Place the contents of your page into a simple layout table. Avoid any width-attributes or width-properties. Browse the page using a whole variety of browsers of different ages on different platforms. Vary the viewport width from maximised to quite small. What happens? (Incredible flexibility). And what would happen with any alternative technique for laying out that page? (Various things, few better than tables).

Layout tables are actually very flexible unless you make them rigid! Their column widths can adapt to both the viewport width and the size of their content. For some people, it is flexibility, not rigidity, that is the problem! It takes effort, such as spacer-GIFs or use of { table-layout: fixed }, to make them rigid.

Layout tables are just mark-up! See what can be achieved, at The CSS Patio Garden.

"User agents won't still support layout tables in the years to come"

Yes they will.

All general-purpose user agents, released while tables are valid, are likely to be compliant enough to handle them as well as they can. And since they can't tell the difference between table-layout and other uses of tables, popular user agents will support table-layout for perhaps the next 2 decades.

"User agents won't continue to render layout tables sensibly"

Yes they will.

They have 2 separate pressure on them. One is to render tables sensibly, because tables are such a vital resource. The other is the fact that perhaps 99% of the useful pages on the web, now and those published each day, use table-layout, and so cannot be ignored. So user agents are getting better at rendering table-layout. Eg. Opera's "small screen mode".

"Layout tables can't fit onto small windows"

Opera "small screen mode" shows me that my table-layout pages on 240-pixel viewports appear OK.

Will future UAs handle them? Since they typically have to handle tabular data, and they can't tell the difference between one use of tables and another, I'm confident they will do their best, and probably handle it well. (If not, then there are much bigger problems to worry about!)

"Layout tales don't conform to modern standards"

Oh, yes, they do!

I put an XHTML 1.1 DOCTYPE into a table-layout page and W3C said "valid". (As it does for 4.01 Strict & 1.0 Strict). Table-layout isn't even deprecated. It is permitted in HTML 4.01 Strict, XHTML 1.0 Strict, and XHTML 1.1. There is a Tables Modules in XHTML 2.0 that allows complex content in the cells. So it will be valid for at least the next decade and probably the next 2 decades.

"Mark-up is not for presentation"

During the early years of the web, "presentation" & "styling" don't appear to have included "layout". Don't casually assume that when someone was talking about "presentation" that they were also talking about "layout". They may not have been.

From the early browser implementations, HTML proposals and standards have been accompanied by visual formatting models/defaults. HTML mark-up has never, in practice, been layout-neutral, as far as I know. Page-authors have never had reason to doubt what would typically happen in practice. Browser developers would be stupid to defy expectations.

As the W3C says: "The HTML table model has evolved from studies of existing SGML tables models, the treatment of tables in common word processing packages, and a wide range of tabular layout techniques in magazines, books and other paper-based documents". They then talk a lot about left to right & top to bottom layout recommendations. All that table-layout people are doing is exploiting the fact that W3C and the user agent developers did some sensible work on how to layout material marked-up with <table>. After devising <table> as a way of marking-up material that conventionally would be laid out in such a grid format in the first place! These were not accidents.

Claims that HTML mark-up was intended to be in any sense layout-neutral is an attempt to rewrite history. Perhaps this will be the case for XHTML 2.0 and beyond, although that doesn't appear to be the case at the moment. It never has applied, and never will apply, to anything before XHTML 2.0.

It is a fallacy to claim that only tables have a significant formatting implication. They simply have a stronger formatting implication, because they are the most complicated bit of mark-up. But lots of HTML discusses the various distinctions between block level, inline, and replaced, elements, and the implications on layout. HTML is full of layout discussions and proposals!

"Layout tables are wrong use of mark-up"

Then why do layout tables validate?

Some people have an opinion that "Layout tables are wrong use of mark-up". But that is all it is. Just an opinion, perhaps based on their own view of how SGML/XML should be exploited. Perhaps it is an attempt to re-fight a battle that was lost a long time ago when standards and technology didn't follow this path of strict separation.

More than a decade ago, some brilliant people had a view that mark-up and presentation should be separated. Perhaps they were right - it should have been possible, and could usefully have been done. But it never was. The important building blocks were never put into place. Those brilliant people apparently didn't foresee the need to control the layout of pages, and left a hole to be filled by people with the need. It was quickly filled!

Are your children pursuing the careers that you intended them to? Or have they pursued a life of their own? The web is pursuing a life of its own. What matters is what we do with it from now on. We can choose to identify new intentions.

"W3C says we should be using CSS for positioning"

What W3C said in 1997 was: "Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display. To minimize these problems, authors should use style sheets to control layout rather than tables".

In other words, they stated some problems and their proposed solution. (Not "must" or "must not", but "should" and "should not"). What relevance does that statement have if layout tables are used in a way that doesn't suffer these problems? The Web Content Accessibility Guidelines (published after the above) don't attempt to ban layout tables. They simply state the way of making them accessible in practice. IBM's "Home Page Reader" was announced in 1998 after the above W3C statement, but before the Web Content Accessibility Guidelines.

Should an author reading that admonition in 1997 should have immediately stopped using tables for layout? In 1997? Of course not! Did that statement by the W3C say that this came into action in 2004? No. It was not a plan. It was a proposal that needs re-evaluation as browsers improve their support for tables, while revealing the problems with CSS positioning.

If an author tries to use tableless-layout and this failed and caused the client to go bankrupt, would the W3C accept responsibility? No. They are not responsible. Therefore they have no rights. Authors are responsible, therefore authors have rights. To use tables if they see fit, and accept the consequences.

"CSS positioning is better with narrow viewports"

I don't trust any browser available to me to handle CSS-positioned columns at narrow viewports properly. They sometimes superimpose the content of the various columns. If narrow viewports matter, I use simple tables! They all appear to get those more or less right. I don't get floating behaviour - but I can't consistently get that anyway.