There are a lot of good reasons to have valid markup on your web sites. In theory, if you use standards compliant code, then your standards compliant web site will work for everyone using a standards compliant web browser.
One of the problems is, the vast majority of us are still using Internet Explorer, which has never seemed to care that much about being in compliance with the established standards. I don’t want to put too fine a point on it, so I’ll just state now and for the record that IE is garbage, and urge those of you using it who have the ability to do so to switch.
Internet Explorer 8, while improved, is still not standards compliant. Come on Windows guys! You lived with a broken operating system for all those years, and now that it’s mostly fixed you are rightfully proud of it. Why defend a broken web browser?
Compatibility you say? What if your favorite web site won’t work in something else?
Here’s the deal. I have never encountered a web site that wouldn’t function in Firefox. I happen to prefer Webkit browsers (Safari, OmniWeb, Chrome), and I have found a few ecommerce sites that made me launch Firefox to use them. In the case of OmniWeb, Omni Group has added the ability to specify per-site preferences, which I think is a great idea. Sometimes just identifying your browser as IE or Firefox to a web site is all it takes.
In any event, if there are web sites out there that won’t work properly in anything but IE you should broadcast to those sites that you support open web standards by not using them until they get their act together. There, sermon over.
Why is there so much bad markup on the web? Probably a combination of apathy and hacking stuff together so that it DOES work in IE. In the case of common content management systems like WordPress and Joomla!, they do generate valid markup. Unfortunately, many of the plugins and extensions we would like to use do not validate without some PHP massaging on your end, and as a result most of the WP and Joomla! sites out there are just as broken as the rest of the web.
If everything else out there is broken should you care? Yes, because if we all cared about whether our sites were valid markup or not then the browser makers would be forced to be standards compliant, eventually resulting in the user experience being the same for everyone regardless of platform or browser. If the site validates and it’s broken in Browser X, it’s Browser X’s fault, not yours.
So while figuring out if I can live without a poll and an ajax search box on my valid XHTML 1.0 Transitional blog so that I can turn it into a valid HTML 5 blog this weekend I became curious. I always include a link to the w3c validator on my pages to proofread my markup for me as I design and change sites. I started checking the validation of some of the most heavliy trafficked and esteemed sites on the web.
Here’s what I found:
- Apple (HTML 5) 6 errors, 1 warning
- WordPress (XHTML 1.0 Transitional) 5 errors, 0 warnings
- Joomla! (XHTML 1.0 Transitional) 3 errors, 2 warnings
- Sony (XHTML 1.0 Transitional) PASSED!
- Netflix (HTML 4.01 Transitional) 7 errors, 5 warnings
- Mozilla .com and .org (XHTML 1.0 Strict) PASSED!
- IBM (XHTML 1.0 Strict) PASSED!
- Burger King (XHTML 1.0 Strict) PASSED!
- BBC (XHTML 1.0 Strict) PASSED!
The Apathetic Norm
- Google (HTML 5) 39 errors, 2 warnings
- Wikipedia (HTML 5) 51 errors, 2 warnings
- Facebook (XHTML 1.0 Strict) 43 errors, 4 warnings
- Yahoo (HTML 4.01 Transitional) 34 errors, 8 warnings
- CNN (HTML 4.01 Transitional) 49 errors, 26 warnings
- Slashdot (HTML 4.01 Strict) 61 errors, 2 warnings
- Twitter (XHTML 1.0 Strict) 71 errors, 0 warnings
- Ebay (HTML 4.01 Transitional) 240 errors, 0 warnings
- Youtube (HTML 4.01 Transitional) 174 errors, 54 warnings
- Microsoft (XHTML 1.0 Transitional) 300 errors, 31 warnings
- Digg (XHTML 1.0 Transitional) 403 errors, 309 warnings
- ESPN (XHTML 1.0 Transitional) 711 errors, 222 warnings
- Amazon (HTML 4.01 Transitional) 1058 errors, 71 warnings
- CNET (XHTML 1.0 Transitional) 1036 errors, 904 warnings
Kudos to the webmasters responsible to the above sites that passed, especially in the case of the strict validation sites. Strict is no joke, so good job.
Google has 39 errors on the page? Really? I can make a white page with a logo and a search box that validates, you’re telling me Google can’t?
Amazon and Cnet. Unbelievable. Someone should get fired for that.
Looking at some of the above examples, you can see from this microcosm of the web that markup in general is not being done with standards compliance in mind. Is it laziness, or is this the result of web designers catering to non-standards compliant browsers?
Whatever the cause, we don’t need to add to this mess. Clean up your code and make sites with valid markup.