views:

606

answers:

6

I noticed that many websites, even Google and some banking sites, have poorly-written HTML with no quotes around the values of attributes, or using characters such as ampersands not escaped correctly in links. In other words, many use markup that would not validate.

I am curious about their reasons. HTML has simple rules and it is just mind-boggling that they don't seem to follow those rules. Or do they use programs that just spit out the code?

+10  A: 
Tatu Ulmanen
Bandwidth cost mitigated by peering http://blogs.broughturner.com/2009/04/youtubes-fine-analysts-dont-understand-internet-peering.html agreements makes estimating difficult regarding to what degree bandwidth conservation competes with other factors Google considers.
micahwittman
It doesn't mean that the programmer at Google code using invalid html. Their clean work is most probably going through a filter before going into the live server that strip any unneeded character (as seen by the source of their homepage).
Pierre-Alain Vigeant
This myth has been debunked many times by pointing out that Google doesn't even optimize their logo image, which would save them gigabytes of bandwidth *a minute*.
RegDwight
+4  A: 

For several websites such as Google, having perfect code is not "that" important.

The total size of the web-page however, is. A few bytes spared on the HTML code can mean hundreds of dollars in bandwidth.

So if they can be certain their page will be rendered correctly, they won't hesitate to tweak their HTML.

Snowangelic
+1  A: 

Generally speaking, coding up a website is easy and therefore the entry barrier is very low for inexperienced or non programmers. This makes it easy to produce sub standard pages and the web is littered with them. Combine that with tools like Microsoft Frontpage that makes it even easier to make a site (and even easier to generate bad HTML code) and you've got a nasty situation.

Noufal Ibrahim
+6  A: 

As been discussed previously, google does it for bandwidth reasons.

As for banks and other enterprisey websites, there could be multiple reasons-

  1. CMS spits out invalid HTML
  2. Dreamweaver, enough said.
  3. Tend to use commercial UI components that have been designed to work even on ancient browsers so they err on the careful side.
  4. No emphasis on good HTML and Javascript practices. Many of them tend to be Java or .NET shops with no good UI developers.
  5. Badly designed .NET User controls and JSTL taglibs.
Chetan Sastry
+1 very good answer.
Pekka
You forgot MS Frontpage. Produces far worse code than Dreamweaver ever thought of. Can't tell you how many hours I've wasted cleaning up someone else's code from Frontpage just because of all the garbage that makes it nearly impossible to read.
Tom
Or export a Word document as HTML and upload it as a web page. Ugly as hell.
Pierre-Alain Vigeant
+44  A: 
Triptych
Nice answer with "real world" insight.
Ogre Psalm33