8

Is CSS all that Great?

by sciske 24. March 2009 15:00


Any web developer that’s been around a while remembers the magic of table layouts.  It was part of every tutorial on how to create a website.  The days have changed and now we see a big push for CSS everywhere.  CSS zealots are everywhere, almost as prolific and dedicated as Mac fans!  But is CSS evangelism all it’s cracked up to be?

I recently read a blog post named The shallowness of CSS evangelism.  Clearly titled to get a hair raising out of any CSS fan-boy.  The post was debunking some of the common myths of the CSS vs. Table layout debate put forth in this blog post.  To be honest I’ve been exposed to the ‘CSS is the best way to go’ line for so long that I’ve become to take it as fact.  I’ve clearly broken the unwritten cardinal rule of coding: Keep it Simple Stupid (KISS).    So here comes the wakeup call:

CSS versus tables is another known permathread. It's only recently that the voice in favour of tables layout has improved it's position significantly. Unfortunately the same cannot be said about the rabid pro-CSS group. They continue to spout nonsense and hope no-one looks too deeply at the arguments, and hope enough commenters reply that it couldn't have been said better. Except there is large room for improvement, or perhaps reformulating the argument into something that is backed by real world evidence.

The pro-CSS article lays out 13 ways that CSS trumps table based design.  These are:

1.Faster page loading
2.Lowered hosting costs
3.Redesigns are more efficient
4.Redesigns are less expensive
5.Visual consistency maintained throughout website(s)
6.Better for SEO
7.Accessibility
8.Competitive edge (job security)
9.Quick website-wide updates
10.Easier for teams to maintain (and individuals)
11.Increased usability
12.More complex layouts and designs
13.No spacer gifs

The pro-Table author does a good job to debunk all of these.  The ones that I found questionable that the pro-CSS article even made were: 6) Better for SEO, 11) Increased usability, and 10) Easier for teams to maintain.  The anti-CSS post did a good job debunking, but I would like to add to these three, and who knows, maybe add them to my standard interview questions.

6) Better for SEO

I have no idea how you could even make this argument.  It’s all about the content, and it always has been.  In fact you could make the arguments that, for the most popular search engines it’s all about back links. 

11) Increased Usability

If anything it complicates usability.  Make all the print-friendly arguments you want, but have you tried to keep up with the browser market lately?  Most browsers interpret a table layout the same way.

10) Easier for teams to maintain

I just got this picture in my head of my test automation guy blowing a gasket.  All pages in the site are updated?  One layout change can have a significant impact on other teams.  It’s not trivial and can add risk and time to any project.  I wonder what the project guys at Microsoft, Google, or Amazon would say if some developer ‘easily’ changed some menu layouts!

This is an interesting argument, one in which I agree with the anti-CSS post, we need to have an open dialog before accepting something as fact.  It’s a lesson for me and I hope you can learn from it as well.

Tags: , ,

Internet | Software Development | UX

Comments (8) -

rakesh
rakesh
3/24/2009 7:23:24 PM #

Nice post dude. http://tutorialfeed.blogspot.com/

Dave
Dave
3/25/2009 2:07:04 AM #

Until someone can show me how to create a "table" with DIVs and CSS that stretch vertically and horizontally the same way a real table would, I refuse to buy the "tables are dead" bunk the "css fan-boys (and girls)" want to feed us.

That being said, there is a lot of value in using CSS as your primary layout mechanism.  So, my basic rule of thumb is, CSS first, tables where that clearly will not get the job done.

sciske
sciske
3/25/2009 2:54:22 AM #

@Dave - You have a good point.  But CSS isn't the end all be all.  I actually love using CSS.  This was just the flip side to an argument you never hear!

Steed
Steed
3/25/2009 3:18:17 AM #

All those reason for CSS given above are moot (but should not be discounted).

There is only 1 reason to use CSS for layout and that is:

BECAUSE THATS WHAT CSS IS FOR!!!

Tables are for TABULAR DATA

If you find it too hard to create any layout in css, especially with all the tools out there, then you are no good at web development and you should find a new HOBBY

John Rockefeller
John Rockefeller
3/25/2009 5:05:38 AM #

I agree with Steed.
I also find it interesting that this article is on a site built entirely with <div> elements and CSS, with the exception of one table -- a calendar, which is exactly the sort of things tables are for.

john
john
3/25/2009 6:17:29 AM #

just go with what works. Browser support for table layouts is more consistent than CSS and the end user doesn't give a crap about how it's wired up under the hood. The W3c recommends css for layouts but really, only css3 deems worthy of using css for layouts imo. Yes, you can lay out sites with css1 and css2 but it's not very intuitive and is a bit more complicated than it needs to be. Tables to me are just more intuitive and i don't have to worry about cross browser bs. I'm more programmer than front end guy so i don't have time to wrestle with those issues. So until the analytics for my audience show that at least 90% of them are using css3 compliant browsers i'm sticking with tables for layouts simply becasue i can.

Frank Silbermann
Frank Silbermann
3/25/2009 10:58:34 AM #

If you want to share some layout decisions across many pages and be able to change them all in one place, one option is to encapsulate that bit of design in a custom component.  Granted, custom components are a huge burden to write in most technologies (e.g. ASP.NET and JSP), but they are trivially easy to build in Wicket.

If abstraction, generalization and inheritance are good for programming business logic, why wouldn't you want to use those same object-oriented techniques when programming the presentation logic?  (In Wicket, a custom component comes with its own HTML fragment to layout the details; the component relies on this fragment everywhere the component is used.  Change the HTML fragment in the component definition, and you change the look-and-feel of every display of that component.)

Swizec
Swizec
3/26/2009 1:17:56 AM #

There is only one reason that CSS is better than tables and one reason only: Semantics.

Arguably, nothing else actually matters at all. Yes it's a bit more difficult to develop semantic webpages, but you know what, it's also much easier to make them work properly on tiny phone screens and large cinematic displays. All it takes is writing a different CSS file for different devices.

Of course, a lot of what CSS is best for is completely trumped by people who suck at it and force themselves to fuse presentation and content back again with div abuse and other similar crap.

Pingbacks and trackbacks (4)+

Comments are closed

Powered by BlogEngine.NET 2.5.0.6
Original Design by Laptop Geek, Adapted by onesoft