40

Possible Duplicate:
Does it make sense to use the <table> tag on a “modern” website?

Everywhere I go I see don't use table layout, it's evil, even Google says that, so why one of the most visited websites, Google and Twitter, use it for their homepage?

I don't think it is any kind of mistake, or any other stupid problem.

The only reason I can think of is, that they want the page to look similar even if client doesn't support CSS, like with Lynx.

So why everyone say it is so bad, if the biggest websites on the internet use it.

In my opinion, there are some cases, like those mentioned above, where it is vitaly important to have the same look everywhere, than it is OK to use tables.

edit: The same question goes about html elements like <center>, or formatting text with attribute align and other "html attributes and elements used to substitute CSS functionality"

Community
  • 1
  • 1
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
  • 1
    This is a good question. I also notice the major businesses aren't even XHTML compliant, microsoft, even google. What is the best way forward? – DanDan Aug 05 '09 at 22:20
  • 2
    Dupe of a dupe of a dupe... see http://stackoverflow.com/questions/796504/does-it-make-sense-to-use-the-table-tag-on-a-modern-website/796525#796525 for one. – womp Aug 05 '09 at 22:21
  • 2
    its not exactly a dupe, since this one is really specific – Jakub Arnold Aug 05 '09 at 22:21
  • 1
    Many of the big sites have truly shocking markup. Look at Amazon for example. – Steve Claridge Aug 05 '09 at 22:24
  • 2
    How bad is Amazon's, really, given that it's a floating layout and it works on old, terrible browsers? I've been watching it and it's been getting better, but a lot of retailers still get tons of hits from old browsers. – Nosredna Aug 05 '09 at 22:29
  • 1
    I'm guessing the center tag was used for both the browser compatibility as well as the fact that the bytes needed for one center on google's main page in css would be more than those to compose a center start/end tag as below: .c{text-align:center}
    Those add up with millions of requests For the same reason, they actually use three periods instead of the HTML character … for ellipsis
    – jkelley Aug 05 '09 at 22:38
  • I guess that its important to say that twitter did used tables, but now it doesn't. – Fábio Antunes Nov 26 '09 at 13:22

9 Answers9

18

Page load time is king for these guys, and bandwidth usage is extreme.

I'd have to say they use tables for raw data speed, since they are serving up so much bandwidth every day.

Also, notice that they use inline styles in the page header to reduce the number of HTTP requests to help speed up page load time.

jkelley
  • 2,570
  • 3
  • 21
  • 24
  • huh, I absolutely didn't think about this, but it seems reasonable – Jakub Arnold Aug 05 '09 at 22:23
  • 2
    I also have to agree with the other answer that tables are very useful for displaying *tabular* data. Additionally, they do provide an excellent way to get cross browser consistency for such minimalistic page layouts. – jkelley Aug 05 '09 at 22:24
  • 11
    Tabular layouts tend to use more bandwidth, not less. – Quentin Aug 07 '09 at 09:53
  • But their tables are quite small, minimizing additional markup from the tags. They are used for laying out forms where a stylesheet may actually add more bytes to get a properly styled set of div's or block elements that render consistently across browsers. The autocomplete table on google is a mystery to me though. It seems like it would be a great candidate for a simple list. – jkelley Aug 07 '09 at 14:10
  • 1
    Twitter, at least, uses a plain old "It's 1997 again" layout table to handle it's two column layout. Google's tables also do plenty of things that are easier and smaller with CSS. They just suck at markup. – Quentin Aug 07 '09 at 16:32
  • fair enough, i must concede. so why then would they not take the 45 minutes to streamline the markup that could save them so many GB of data per day? – jkelley Aug 07 '09 at 19:47
  • Why do tables decrease load speed? pls explain. For the example of three block level un-styled elements I make three divs 33 chars and a table with three cells 69 chars??? DIVS = 33 =
    . TABLES = 69 chars =
    . I make that double the data for tables than for divs a very basic example I know but why are tables faster to load?
    – megaSteve4 Aug 15 '12 at 22:48
17

Table layout gets more grief than it deserves. It's easy for developers to use, it's consistent across nearly every web browser, and it allows you to easily add rows/columns with little to no effort.

The only downside is that it goes against the mantra that your document should only contain content, and your design should be contained separately (in a CSS file).

Mike Trpcic
  • 25,305
  • 8
  • 78
  • 114
  • 18
    Table layouts aren't *easy*. They are *lazy*. There is a whopping big difference. Try maintaining someone's "easy" table-based layout and you will want to rip your hair out. The magic of CSS is not shorter upfront development time, it's maintainability and extensibility down the road. – William Brendel Aug 05 '09 at 22:51
  • 2
    In addition to making *less readable markup*, *more markup* and *less usable websites*, it's just plain bad practice to use tables where not appropriate. Plus, when you get the hang of CSS-based layouts, it's faster to do them than the old table based ones (except if you use a WYSIWYG editor, which you just should not do anyways because of the low quality code). – Arve Systad Aug 05 '09 at 23:21
  • 2
    Tables are fantastic for layout. CSS just isn't ready for handling many typical layout scenarios. Anyone trying to do anything other than basic layout with CSS likely is a "CSS astronaut" (see this great answer http://stackoverflow.com/a/527826/254441) – Plynx Jan 07 '13 at 17:24
14

Google doesn't have to care about ranking high in search engines... ;)

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
11

Yep, agreed. Sometimes, just sometimes tables are just fine. Not everyone is writing websites that are targeted at every possible browser, that needs to support text to speech etc. In general, try to learn and grow your skills and use CSS positioning etc, but nothing bad will happen if someone uses a table to position things on a webpage.

Maybe this question should be community wiki, though?

Neil Barnwell
  • 41,080
  • 29
  • 148
  • 220
  • I strongly disagree with this statement. Tables are only fine if you put tabular data in them; all other content should be marked up in a semantic way -- this makes pages fall back nicely when CSS isn't supported. (I agree on the community wiki bit though :)) – You Aug 05 '09 at 22:20
  • 6
    Markup should be semantic, and agnostic of presentation... but sometimes, tables are appropriate, even for non tabular data. Economics trumps ideology, and much as it would make things simpler, there is no one true way for every single situation. I avoid tables like the plague, they are a PITA, but no kittens will actually die if you do use a table, and sometimes, it just works better. – seanb Aug 06 '09 at 00:00
  • 1
    You wouldn't believe the downvotes I've had on this answer. Geez. 7 upvotes and 8 downvotes, no less. People get really weird about this sort of thing. – Neil Barnwell Aug 07 '09 at 09:50
  • 2
    @Neal - you got +1 from me for being pragmatic. I used to be quick to leap to judgements about other people doing things "wrong", now am more willing to offer my peers the benefit of the doubt, and realise that maybe they had a good reason for doing it that way, amidst the varying imperatives of real world development - things are not always as cut and dried as academic abstracts. The pragmatists at google and twitter probably thought about it very hard, and do it that way because it works best for them right now - not because they are lacking css skills or just being lazy. – seanb Aug 07 '09 at 23:53
6

It's evil, it's a pain, but rendering is pretty much guaranteed to be consistent across different browsers.

karim79
  • 339,989
  • 67
  • 413
  • 406
  • whats evil ? ( more specific,please ! ) – n00ki3 Aug 05 '09 at 22:22
  • @n00ki3 - IMHO, mostly the ugliness of the markup compared to a CSS layout. – karim79 Aug 05 '09 at 22:23
  • 3
    @n00ki3: Tables are for tabular data; using them for layouts is unsemantic, inefficient, unmaintainable, and almost guaranteed to confuse screen readers and the like. – You Aug 05 '09 at 22:26
4

Table layout is working on most browsers. Google and others want to reach all user, not some or only modern users. Having different layouts or layout technologies is hard to maintain and costly in delivering content. Table layout is not tricky. Its straight forward. You dont have to look for css hacks, browser incompatibilities or others.

Table layouts are bad. Because thy mix layout and content.

Christian13467
  • 5,324
  • 31
  • 34
3

Twitter works pretty well from phones in web mode. Some web browsers are truly gruesome, so I assume Twitter does what it has to.

Given how poorly so many web sites work on phones, I'm more concerned about mobile compatibility than with the concerns of CSS evangelicals.

Nosredna
  • 83,000
  • 15
  • 95
  • 122
  • 1
    Compatibility with mobile phones and such is easily accomplished if you just care a little. That's why we have `@media`. – You Aug 05 '09 at 23:01
2

Three main reasons:

  1. Tables are mainly bad for search engine reasons (there's also the issue of them messing up the DOM a bit, but that's not too bad). People don't search for Google on search engines, and people don't search for Twitter posts on generally either.
  2. Tables render consistently on nearly every browser, including smartphones (which is a big concern for Twitter especially).
  3. Tables consume less bandwidth. Both sites have immense data loads and need every bit of speed they can get.
Imagist
  • 18,086
  • 12
  • 58
  • 77
  • 2
    Your third point is wrong. Tables actually take *longer* to render than CSS-based layouts. Perhaps you meant "tables consume less bandwidth"? – William Brendel Aug 05 '09 at 23:27
1

Browser Support - These guys need to have their websites render perfectly on ALL web browsers (New, Old and Obscure). No matter who's using their websites and what OS/Browser their using, these websites need to work.

Each web browser supports it's own implementation of CSS and this causes a similar issue to that of the JavaScript DOM support in various browsers.

Page Load Time - Also their pages are optimized for Page load times. If it takes a user too long to load the page they'll just go somewhere else. There are still plenty of users without broadband, even a lot of mobile devices don't have very fast connections depending on where you are.

Chris Pietschmann
  • 29,502
  • 35
  • 121
  • 166