<!DOCTYPE ...>

Usage Recommendation
Use this tag if you want to use an
SGML/HTML validator. Otherwise, this tag is of little use.

The <!DOCTYPE ...> declaration (technically it's not a "tag") should be the very first thing in your document... if you choose to use it at all. <!DOCTYPE ...> tells the browser what version of HTML you are writing in. More specifically, <!DOCTYPE ...> declares that this document conforms to a specific version of HTML, and specifies what version that is.

The necessity of <!DOCTYPE ...> is a subject of much debate. The standards published by W3C require the use of <!DOCTYPE ...>. However, much of the HTML being written does not conform strictly the W3C specifications, and so using <!DOCTYPE ...> (which is, after all, a claim that you conform to the standards) would seem unnecessary.

However, <!DOCTYPE ...> has its place on a page, even if you decide to use a little non-standard markup. <!DOCTYPE ...>'s most useful purpose is when used in conjunction with one of the various HTML analyzers. The analyzers look to the <!DOCTYPE ...> to determine what type of HTML you are trying to write. Our recommendation is that you use the appropriate <!DOCTYPE ...>. It won't hurt and allows you to make use of the HTML checkers available.

This is the <!DOCTYPE ...> declaration for HTML version 3.2:


For HTML 4.0, the situation is a little more complicated. There are three standard doctypes. The DTD for documents that strictly conform (don't use any deprecated markup) and that aren't frameset documents, use this <!DOCTYPE ...>:


For a not quite so strict conformance (uses some of the deprecated markup such as <CENTER ...>), use this <!DOCTYPE ...>:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

Finally, for documents which are frameset documents (the "top" document in a framed page), use this <!DOCTYPE ...>:


About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.