According to Google’s latest guidelines to speed up the web, there are a number of optional tags in HTML4 that you can omit to save speed, even if it makes you feel a little queasy as a developer. (Google is quick to point out these tricks are for HTML and not XHTML.)
For example, according to the HTML4 DTD — you can omit tags like <body> and </tr> and all sorts of optional tags that browsers have to cope without.
But are you feeling lucky enough to actually exclude those tags? Do you believe browsers all handle that particularly well in the wild west of the web? It may annoy your development tools and code beautifiers when you leave it out, but I can assure you browsers have long since managed this process so well that you can depend on it almost without fail.
What surprised me:
The Google homepage and search results pages don’t end their <body> and <html> elements. They just leave them open– a lot like a lazy developer might do and then feel guilty when he comes back and sees the mistake.
Only this “mistake” is really part of Google’s strategy of treating their performance as a competitive advantage. All browsers work well without the tags and the tags take up time, so they’re excited to eliminate any millisecond they can for their visitors.
If you already knew and used this trick, well, then you’re in the minority because none of the other top 10 sites (Alexa) take advantage of this to reduce bandwidth and improve the download speed. Admittedly, for complex pages it’s a very small percentage of bytes per view (14 bytes or so per request), but why would you send your visitors more information than they need?
How many times have you tossed in added HTML cruft and not thought about it? Well, visitors will feel it again and again over time, so you might want to think a bit about the junk you add in your HTML– even if you don’t cut corners as tightly as Google does on their own homepage.