“Tables or Divs?” It’s a classic question in the web development world, sort of like “boxers or briefs?”
There is a mailing list that all of the Microsoft Regional Directors belong to. Regional Directors aren’t Microsoft employees–they’re independent developers, architects, trainers, and other professionals who provide a vital link between Microsoft and the developer community. A thread came up on the mailing list earlier this week asking that classic question. Great discussion followed. General consensus was that it’s all about using <div> tags and CSS for layout and tables only for displaying 2D tables of data.
One theme that surfaced is that the code monkeys tend to prefer tables but designers are generally religious about divs and CSS. That’s been my experience too. I’m not a CSS guru, so on the rare occasions when I find myself hacking HTML, I default to tables. (Yes, shoot me.)
One of the posts on the mailing list had some tips for how to “de-program” a developer from using tables and get them hooked on divs and CSS. I thought this was worth sharing:
From Scott Stanfield…
Tables are for displaying a grid of numbers, not for layout. 1×1 transparent GIFs and colspans are so pre-bubble.
My de-programming Check List:
1. Have ‘em watch my video (ASP.NET 2.0) here http://asp.net/learn/videos/video-47.aspx, where I show how to use master pages and themes to build a good CSS-based ASP.NET site.
2. Then show them what the designers have been drooling over: http://www.csszengarden.com/. Jeff Atwood says, “Zen Garden puts the holy grail of separating content from presentation [CSS] squarely in view.” http://www.codinghorror.com/blog/archives/000474.html
3. Then show them the new VS 2008 CSS tools—amazing. Then they should watch Daniel Moth’s excellent “CSS support in Visual Studio 2008” screencast (from https://channel9.msdn.com/showuserthreads.aspx?userid=33347).