Thread: Chapter 10
View Single Post
  #2 (permalink)  
Old March 28th, 2005, 11:30 PM
richard.york's Avatar
richard.york richard.york is offline
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts

When you have tabular data that you must show a relationship between.

I mean most people will tell you to avoid tables in a purely presentational application, but in all honesty even that is perfectly fine. And yes this may go a little against the grain of what I said in my book, cause I came down pretty hard on tables in Chapter 10, but (obviously) didn't really say when it is proper and fine to use one (actually I don't recall if I did or not, but obviously there is some doubt). In all truth tables only become bad when they're overused (nest 'em ten deep, and fill 'em to the rim with transparent gifs), especially when better, cleaner, simpler, easier methods exist (Ahem, CSS). When tables are overused a website becomes a nightmare to maintain, it becomes more difficult to tweak the look and feel without breaking the whole thing, it becomes far less accessible (and all that other stuff I said in Chapter 10).

Standards enthusiasts (myself included) often encourage designers to avoid using tables for purely-presentational purposes (e.g. to layout a whole page) because from a semantic standpoint it isn't the best use of tables, and it is also more difficult to create truly flexiable designs (a la CSS Zen Garden[1]) with tables as opposed to block elements like div.

So there is a fine line here, when I say tables are bad I'm saying overusing tables is bad, because it makes a design exponentally more complex than it really needs to be. So if a table is the most appropriate, use tables, don't try to recreate calendars or other tabular data with divs, that's what tables are for, and when it comes to doing a three-column layout or something like that go with divs, those are more flexible and appropriate for that application (IMHO)!

The biggest mistake I personally see designers making is not using the right markup for data, for instance wrapping headings in <p> and <b> tags, that's what <h1> - <h6> is for! Or worse, going to complicated and extreme measures to manipulate space using <p> tags or transparent gifs, when CSS margin or padding is more appropriate. Look at the source of any non-standard designed site and you're likely to find mostly <table>-esque tags and a handful of others, and very little of it will actually add any meaning to the data. Headings won't be in heading tags, paragraphs will probably be separated by line breaks <br />, that is what I'm saying to not do in Chapter 10, avoid making a mess of your markup!

You'll also be interested in Chapter 16 & 17 BTW, where I explore the possibilities CSS offers using tables, and a few seldom used table tags that are actually very useful.

Hope that clears things up.



Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design