September 05, 2010

The Standards Are There, So Use Them

Imagine a scenario.

Kate has just been hired by Widgets Ltd., a start-up company that is being run in a garage outside Madison, Wisconsin, to create a website for their products. She has no web design experience outside of Comp Sci 101, back in the bad old days of freshman year. "No problem," she thinks to herself. "I've got an old copy of Microsoft FrontPage here. I'll just draw some tables and drop the content in. Easiest money I ever made."

Of course, we, as web developers ourselves, can imagine the hideous code that will result from this misguided approach:
<html><head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Welcome to Widgets, Ltd.!</title>
</head>

<body bgcolor="#00FFFF" link="#00FFFF" vlink="#00FFFF">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="59">
So much for separating organizational and display functions. Kate's work failed to adhere to (or even consider, for that matter) web standards. Without boring you with the details, the above code snippet contains four errors when run through the W3C HTML Validator — and we haven't even made it to any of the actual content yet.

What are web standards, you may be asking? They are a set of guidelines codified by the World Wide Web Consortium (and Ecma International, which standardizes ECMAScript/JavaScript). They define the elements, the syntax, the attributes, the doctypes, everything. Browser developers then take these standards and program their browsers to properly render web pages based on these standards. Opera generally leads the pack as far as standards compliance, with Firefox and Safari following and Internet Explorer trailing in a distant fourth.

Now, designing with web standards does not mean making your website look exactly the same across all browsers. Someone looking at it in Firefox on Windows XP is going to get a slightly different look than someone looking at it in Safari on Snow Leopard. Is that wrong? Is that bad? Not at all. Very few people will even notice without you pointing it out to them. They're different, not wrong — if you coded the site correctly, that is.

So, in summary, my argument for designing to web standards is this. Internet Explorer 6 (and prior versions) didn't care about abiding by web standards, and complications stemming from that caused much wailing and gnashing of teeth. Why would you want your website to even have a possibility of inspiring a response like that? Design to the standards. It will cause many fewer problems.

*The problems described herein are not unique to Microsoft products by any means. However, every time I bash Microsoft, Canonical and Red Hat send me a tenth of a penny. I look forward to being able to afford a gumball.

No comments: