2009年9月14日 星期一

Table good or bad?

Recently, I have searched a lot of information and getting some idea of the disadvantages of using Table in HTML.Then, I summarize them into the following view points.

1. They result in load times that are longer than necessary.
2. They encourage the use of inefficient “placeholder graphics” that further slow performance.
3. Their maintenance can be a difficult.
4. Inaccessible to the partially disable person when coding table by screen reader.

Tables Mean Long Load Times
When designers began to rely on tables to contain all or most of the content of a Web page, they were also saddled with the consequences of this design decision. In addition to the apparent delay that many users experience as a result of tables displaying all at once, the sheer volume of HTML code that’s required to create Web page layouts with nested tables can also add load time due to the increased page size. Table-based layouts almost certainly account for more user concern over long page-load times than any other single factor. Avoiding this significant load time would obviously be A Good Thing.

Use of Transparent Images Slows us Down
Even when using tables as layout mechanisms, designers could not quite attain the detailed level of control they wanted over page design. Sometimes, for instance, a designer might need a bit more breathing room around one part of a table cell—something for which tables do not allow. This kind of precision was unachievable.

Early on, someone came up with the notion of creating a transparent.gif image file—a tiny GIF image that had no visible content. By creating table cells that contained these transparent images, we could force extra vertical and horizontal “space” into tables whose cells were designed to remain in close proximity to one another.

The problem is that, given a table with dozens (or even hundreds) of these images, and depending on a variety of other factors, the performance impact of transparent GIFs on a Web page can be significant. More importantly, though, this technique often restricts the page to a fixed pixel size, and clutters the page with images that are irrelevant to the meaning of the page content.

Tables Cause Accessibility Issues
The fourth reason why tables are bad lies in the way non-graphical browsers—such as the screen readers used by many visually impaired users—read an HTML document. When a text-only device reads the content of a site, it starts at the top and works down the page line by line. When it comes to a table, it starts at the first (top-left) cell, then continues along the top row, then moves to the second row, and so on. In the case of a table that’s used correctly, for tabular data, this is rarely a problem. However, where nested tables have been used to display chunks of text in the desired layout, that content can become nonsensical when read in this manner.

When it’s Okay to Use a Table
There’s one notable exception to the cardinal rule that Tables Are A Bad Thing. If you have tabular data, and the appearance of that data is less important than its appropriate display in connection with other portions of the same data set, then a table is in order. If you have information that would best be displayed in a spreadsheet such as Excel, you have tabular data.

In general (though, undoubtedly, there are exceptions to this rule as well), this means that the use of tables should be confined to the presentation of numeric or textual data, not graphics, multimedia data types, forms, or any other interactive user interface components.

沒有留言:

張貼留言