Web Developer Corner: Converting to XHTML

If you've been a web developer for any length of time, you know how quickly technologies come and go, standards change, and how hard it is to keep on top of everything. And now you've probably heard that the lingua franca of the web -- HTML -- is no longer the markup language of choice; instead, the W3C recommends that, going forward, you create all your pages in XHTML.

Luckily for you, learning XHTML (and even converting existing documents from HTML to XHTML) is relatively painless. XHTML is really just a stricter, cleaner version of HTML, with the promise of greater accessibility and flexibility as the web matures.

Why Bother With XHTML?

"But my code works just fine, thank you. Why should I bother switching to XHTML?"

Well, there are a few good reasons. First of all, as you've probably heard, the web is moving towards XML, which shares the same characteristics (well-formed, valid documents) as XHTML. Using XHTML puts you in a great position to take advantage of XML when la revolucion comes. Because XHTML is a cleaner form of markup, you'll reap the benefit of documents which are easier to maintain and update. If everyone is writing tidy, well-formed pages, it becomes much easier to share work and, in a team environment, collaborate without losing yourself in a sea of poorly organized HTML.

XHTML is also more easily transferred between devices -- it's not just for web browsers on PCs. It can be used to structure pages for handheld devices, cell phones, and other devices. As a result, it's more accessible than HTML; now users reaching your site via screen readers or voice browsers can access your content easily (which will help you comply with Section 508, the government's recent web accessibility legislation).

Cleaning Up Your Code

Converting your existing HTML pages to XHTML is surprisingly easy. Really! All you have to do is follow these few guidelines and voilá... you'll be XHTML-compliant and the envy of all your neighbors.

And that's it! Not so painful now, is it. And with tools like HTML Tidy, you can convert entire sites to XHTML with little or no trouble. If you need any extra guidance, check out the links below or take a look at the source code of this page (and this whole site) -- it's all valid XHTML!

Get your diploma or degree in web development! Check our list of schools and colleges offering programs in web development.

Links