Properly Declaring DTD's in HTML Documents

By: Daniel Imbellino
Updated: Feb 28, 2013

A Document Type Declaration specifies to the browser what type HTML is being used. There are a number of variations of the HTML markup languages, such as: html 4.01, xhtml1.0 (strict, transitional, frameset, etc), html5 (worthless), and soon xhtml5 (this is a good thing because html5, so far, is a sore loser at best. We need to stick with the extensible markup language platform in the long run).

The use of a Doc Type Declaration in web pages is important as the browser needs this information In order to accurately display the content embedded within the web pages code. Being as some tags and tag implementations in HTML differ between different versions, the Doc Type Declaration is absolutely necessary.

Here are some of the various Doc Types used in HTML:

HTML 4.01: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

XHTML 1.0: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

You can also specify whether the document is “transitional” (xhtml that is backward compatible with html 4.01), “strict” (conforms strictly to xhtml coding standards, meaning the markup code errors that were acceptable in html 4.01 are not acceptable in xhtml), and “frameset” (for use with iframes and inline elements).


Ex: <!DOC TYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “”>