Ever look at the source code of a web page and find a hideous looking line that looked something like this:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

Technically speaking, you can write web pages without this line of code. However, the communication between your web page and the browser will be impaired.

Let me put it like this. Imagine you go visit a foreign land. You need directions to get to the local attraction. However, you do not know how to speak the native tongue. The very first question you ask anybody is going to be “Do you speak (enter your native language here)?” You desire to find someone that speaks your language so you can get directions. When you do find that person, the possibility of getting the right directions increases dramatically. If no one around you speaks your language and you can’t understand them, you will end up wandering the streets aimlessly.

DOCTYPE is the initial greeting between a web page and the browser. The web page says “Hey! I speak this kind of (X)HTML, do you?” The browser replies with a resounding Yes! and continues to display the webpage according to the specifications of that DOCTYPE. If no DOCTYPE is specified the browser will attempt to display your web page, but you can’t guarantee the results. If your website is simple, it will probably display correctly. However, any site with any level of complexity will experience problems.

Guidelines:

1) Always include the DOCTYPE at the top of every web page. Build it into your templates.
2) Choose a DOCTYPE that is a current standard, hence XHTML 1.0.
3) Choose a DOCTYPE that is strict. Remember, a strict master is a good teacher. You will learn to create cleaner code.
4) Using a DOCTYPE allows for HTML/website validation.

Learn more about DOCTYPES from the following resources. These pages include the code for writing the correct DOCTYPE.

My Web site is standard! And yours?
Fix Your Site With the Right DOCTYPE!
W3Schools

Articles arguing for the use of strict kinds of DOCTYPES:

Transitional vs. Strict Markup
No more Transitional DOCTYPEs, please
It’s Time To Kill Off Transitional DOCTYPES

[tags]standards, web, webdesign, doctype, html[/tags]

 

About the Author

Paul Flyer loves to research the web and find resources and tools for building, maintaining and promoting websites. Based in Saint Louis, MO, he works in management and spends his free time sharpening his web development and copy writing skills. Feel free to contact Paul with any questions, comments or ideas. He is also available to help you with your own website.