Trevor said:
I hear this anti-table comment often, but I fail to understand it. I
assume people refer to CSS replacing tables, but CSS seems incapable
of handling nested tables presentations and the ease of writing
tables.
I copied the code from google.com showing how the world's number one
website uses tables:
START QUOTE
</head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b
alink=#ff0000 onLoad=sf()><center><table border=0 cellspacing=0
cellpadding=0><tr><td><img src="/images/logo.gif" width=276 height=110
alt="Google"></td></tr></table><br>
<table border=0 cellspacing=0 cellpadding=0><tr><td
width=15> </td><td id=0 bgcolor=#3366cc align=center width=95
nowrap><font color=#ffffff size=-1><b>
etc
END QUOTE
From what I have seen all major sites uses tables, eg yahoo.com,
ivillage.com etc
So where's the argument against tables?
Most of the arguments are of purely religious nature (it's the "wrong"
way to do it), but there are a couple practical considerations too.
Tables-based layouts use more code than HTML+CSS layouts. Although the
HTML code's filesize is sometimes negligible compared to all the images
and other media files, cleaner HTML code with CSS layout can save quite
some bandwidth. For example, espn.com reported they expected a bandwidth
save of 2 terabytes per day:
<
http://devedge.netscape.com/viewsource/2003/espn-interview/01/> (not
that they're particularly standards compliant...)
Writing HTML+CSS is faster. You just markup your content with headings,
lists, etc, without even thinking about layout. Then, if your layout
requires it, you group the content with generic containers into sections
like "advertising banner", "navigation", "content" etc. Once that is
done, you attach the styles to those elements and containers. In my
experience that's a lot faster than tweaking tables.
Clean HTML with CSS also tends to be easier to manage; since all the
layout is in one central CSS file, you can debug the design of
practically the whole site, and tweak it to work in quite an impressive
range of browsers, by changing one single file.
There are quite a few obvious drawbacks, of course. One drawback is that
you need to learn not only a new technique but also a whole new concept;
and some things that were easy with tables aren't quite as easy with
CSS. But other things (quite a few!) are much easier with CSS than
without.
Most importantly, today's browsers neither support CSS well, nor
consistently, which means that a lot of the time you save, you have to
invest into debugging the stylesheet. And obviously there's next to no
support at all in legacy browsers.
Some people think it's OK to just drop users of those browsers, but
others disagree. Then again, those who disagree are quite often the same
that use CSS to re-create tables-based layouts - and that really makes
you wonder what the argument against tables is
.
The point about Google is of course entirely valid: They don't do it, so
why should we? On the other hand, it wouldn't be all that difficult to
recreate their "layout" with CSS - several people have done it, with
varying success.
Matthias