XML technologies / CSS / Advanced websites with CSS / An initial overview / Why most tables are bad

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

Why are tables such a bad idea as a web design tool? There are many reasons. The main ones are:

  1. They cause unnecessarily long loading times.

  2. They encourage inefficient spacer graphics that delay page rendering.

  3. Creating and maintaining them can become a nightmare: tiny HTML changes can wreck the entire page layout.

  4. They can make a page inaccessible to users without graphical browsers.

Tables cause long loading times

Few users realize that a browser is programmed to download each table from the server as a whole, rather than progressively. It displays nothing inside until all components have arrived. (Note: Cascading Stylesheets Level 2 (CSS2) includes the property table-layout, which can change this behavior in certain circumstances. For full details, see CSS property reference.)

This makes sense considering the purpose of tables. HTML tables are intended to present data clearly in rows and columns. Each cell contains a value to compare or connect with others in the table. Separate, unrelated fields are not intended: a table should form a complete unit both technically and in meaning.

When web designers began putting most page content in tables, they therefore had to accept consequences. Besides the delay caused by non-progressive rendering of nested tables, the sheer amount of HTML can increase loading times. Complex table layouts are probably a major cause of long waits on the Web.

Avoiding such long loading times would be a good thing.

Transparent images slow things down

Even tables cannot give designers exactly the appearance they want. A designer may need more space around one cell than around the others, for example, which HTML does not provide.

Someone soon thought of using the image file transparent.gif, a tiny transparent GIF with no visible content. Placing it in a cell forces extra horizontal and vertical space.

This becomes a real problem when a table contains dozens or hundreds of these images. Transparent GIFs can seriously affect page performance. Worse, they fix essential layout components in pixels and fill the page with images unrelated to its content. This also seriously affects accessibility for disabled users, who struggle to make sense of nested tables; more on that later.

Maintaining tables is a nightmare

The third problem is maintaining deeply nested pages. Tools such as Macromedia Dreamweaver or Adobe GoLive let you ignore most of the mess because you never see the HTML directly. But even these programs are imperfect, and repairing the chaos they sometimes create is a real challenge.

If, like most designers, you trust only your own source and would rather drop dead than use an HTML editor, you probably know table problems well.

Tables are difficult because even unnested ones comprise a fairly complex set of HTML elements. Nested tables make it considerably uglier.

HTML editors that, unlike programming environments, fail to generate readable source make matters much worse. Finding table boundaries, particular rows or cells quickly becomes a search for a needle in a haystack. Even when only the most experienced HTML experts can help, they cannot solve the problem however hard they try.

Tables cause accessibility problems

The fourth reason concerns how nongraphical browsers, including screen readers used by many visually impaired people, read HTML. A text-based device starts at the beginning and reads line by line. On reaching a table, it starts at the upper-left cell, reads across that row, then the second row, and so on. Proper data tables rarely cause trouble, but nested tables used to arrange text visually can produce complete nonsense in this reading order.

When tables are appropriate

There is just one exception to the rule that tables are inherently bad.

A table is appropriate only when data is genuinely tabular and should appear in clear rows and columns. If information is best presented in a spreadsheet, such as an Excel spreadsheet, it is tabular data.

In my view, with few exceptions, tables should contain only numeric or textual data, not graphics, multimedia, forms or other interactive interfaces.

  

 

 

 

back to top