<DOCTYPE> Document Type Declaration

The DTD(<DOCTYPE>) document Type Declaration tells the browser which version of (X)HTML you’re using, so it will know how to display the page. The doctype declaration refers to a Document Type Definition (DTD). The document type declaration must be appaer at the beginning of your code that includes a reference to the DTD for the markup language your Web page uses.

The DOCTYPE declaration is also necessary if you want to use a validation tool to ensure that your html is valid.

A DOCTYPE declaration consists of two parts.

  1. A definition of the HTML version that a web page use.
  2. A path called URI (uniform resource identifier), to the Document Type Definition(DTD) that define the (X)HTML version.

There are three types of DTDs, which can be specified using the DOCTYPE tags in either XHTML or HTML.

  1. Strict: This DTD contains all HTML elements and attributes. Use strict DTD when you want a clean markup, free of presentational clutter. In DTD strict all styles will be handled by CSS. It does not support presentational or formatting tags (like font, center, u). Also Framesets are not allowed.
  2. Transitional: This DTD contains all HTML elements ans attributes, including presentational and formatting tags. Allow you to use a mixture of CSS and legacy HTML formatting to design a page. Framesets are also not allowed.
  3. Frameset: This DTD contains everything in the transitional DTD plus elements and attributes to creating frames.


The general syntax for a Document Type Declaration is:

<!DOCTYPE root-element [SYSTEM OR PUBLIC FPI] “uri” [
<!– internal declarations –> ]>

Example: Let’s say for XHTML 1.0
XHTML Strict DTD is the most strict DTD available: no deprecated tags are supported and the code must be written correctly.

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

XHTML Transitional DTD is like the XHTML Strict DTD, but deprecated tags are allowed. This is the most popular current DTD.

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

XHTML Frameset DTD is the only XHTML DTD that supports Frameset. The DTD is below.

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

you can find HTML’s all versions dtd here:

Joginder Poswal


This entry was posted on Thursday, August 20th, 2009 at 11:17 pm and is filed under Web Design, Web Standard. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

This blog is kept spam free by WP-SpamFree.


Get Adobe Flash player