Document Types

Posted March 24th, 2005 by Mike Cherim

I see craziness on the web all the time: I view a page’s source code, as I often do to see how people build their pages, and see an omission of the Document Type or "DOCTYPE" for starters. All websites should declare a DOCTYPE as it tells the browser what it’s supposed to be reading. Tell it what to do, don’t let it decide for you. When it does that it goes into "Quirks Mode" and that doesn’t sound like a good thing at all, does it? Want to see the document types you can use?

I recently read some advice given in a Flash developers’ forum. A person was having trouble with the appearance of a web page they made. Someone responded by saying they needed to remove their document type. They went on to exclaim that that always seems to screw things up. The person needing help did as he was told. Sadly, it worked, totally sending the wrong message. What the person needed to do is write their code up to the standard of that specified by the DOCTYPE they declared. Instead the problem was addressed in the opposite, and completely wrong, manner. The page now works, perhaps, but on what? One browser, two maybe? And how will look tomorrow when technologies change once again? This craziness I mention, the DOCTYPE thing is just the tip of the iceberg as they say.

Case in point: I recently read a post on a popular web developers’ forum. The person who started the thread was having their site reviewed. It was really messed up. Their DOCTYPE and code were mismatched. Someone, me if I recall, pointed it out. The person asking for the review asked what the heck a DOCTYPE was. Come to find out, they had basically stolen someone else’s source code, changed the content, and went public with it. This is craziness. First, ripping off a whole site isn’t very nice or fair to the person who originally wrote it (even though peeking at source code for study is perfectly fine). Second, it is blatantly irresponsible. Craziness I tell you!

The Beast Blog’s code is written to the XHTML 1.0 Strict specification, as the DOCTYPE declares — though it was written to the XHTML 1.0 Transitional specification when I downloaded it from for some strange reason. I had to make a few changes to bring it up to speed. By this statement, "bring it up to speed," I mean, if you’re going to publish a page, whether it be XHTML or HTML, not only should you declare a DOCTYPE and properly mark it up to match, it should be done to the highest version of that specification possible, unless there is a damn good reason not to (though for the life of me I can’t think of one, maybe someone will enlighten me). In the case of XHTML, the current high specification is XHTML 1.1 Strict, but this Blog, being that it’s served to the browser as text/html, versus application/xhtml+xml, XHTML 1.0 Strict is the high mark. This is how is how it should be. Please consider this the next time you mark-up a page or site of your own.

Please note: If you are going to write to an XHTML-level specification and serve it to browsers as text/html, instead of as application/xhtml+xml, it is really critical what it is and remains valid. This is not that hard to do. Just be sure to check it with the free-to-use W3C Mark-up Validator during the build and whenever you make edits for the life of the site. This will assure the best possible results.

One Response to: “Document Types”

  1. Adam Baumann responds:
    Posted: November 1st, 2005 at 5:58 am

    Excellent! I enjoyed reading your material.

Sorry. Comments are closed.

Note: This is the end of the usable page. The image(s) below are preloaded for performance only.