Nothing Wrong With The Good Old Table Tag

Posted By : todd sharp Posted At : October 17, 2006 9:06 AM Posted In: ColdFusion

6

Terry asks:

Do you know of any good sites/tutorials that show how to display a ColdFusion query result using css instead of tables?

My answer was simple - Why? I think too many people get caught up in the hype of CSS and think we should abandon all usage of the good old <table> tag. I completely disagree with this sentiment. I think tables should be used for what they're good for - displaying tabular data. What is a query? Tabular data. Besides that fact that it's definitely appropriate, I think it would be a complete pain to try to build a "table" with divs and spans,etc. Use css to style the table, but for goodness sakes use that table!

Comments (6)

Ryan Everhart's Gravatar Todd,
Good post and point! I agree with you that there is nothing wrong with <tables> and they have their place. Add the fact that you can use CSS to style them up makes them all the more friendly to use. I did however have to blog about your post... send a brother some hits will ya???

http://ev.instantspot.com/blog/index.cfm/2006/10/1...

Ryan

Christopher's Gravatar Don't forget to mention the CFTABLE tag:

http://www.cfquickdocs.com/?getDoc=cftable

While not perfect, it'll build your output for you :)

Sandra Clark's Gravatar I always smile to myself when I get asked that question. The answer is to use a table to display tabular data. But still use proper table markup. Use the groupings thead, tfoot and tbody correctly. Use th for your headings and relate them to the cells using the scope attribute. When you do that, it is not only easier to style using CSS, but you make the tables have more meaning to those who have to listen to your tabular data rather than seeing it.

shunjie's Gravatar IMHO table tags are also more SEO friendly compared to CSS. It is easier to see the link between different columns from a crawler point of view. Of course, by the time you build 1 'table' with div and spans, you will have build 10 tables with table tag. Sometimes its just able getting the job done . =)

Sandra Clark's Gravatar Actually tabled layouts (which I am assuming you are talking about) are not SEO friendly at all, when you build tabled layouts, you are building visually, rather than using a structured paradigm. Using structural HTML, actually creates a more usable, and crawlable site than tables. Remember, search engines are blind. They can only deal with what is in the HTML code and your content. Structured HTML consistently gets placed higher on a search engine than a old style tabled layout.

RickyBobby's Gravatar Thanks for the discussion on this. I asked this same question to a coworker just yesterday.