Home     SSI Lab     CSS Templates     CSS     Htaccess     Web Design     XHTML

XHTML Tutorials




CSS Templates



Web Design





XHTML Doctype

What is Doctype Definition, DTD?

"A DTD, or document type definition, is a collection of XML declarations that, as a collection, defines the legal structure, elements, and attributes that are available for use in a document that complies to the DTD."

Erm...ok, basically the doctype specifies the rules that apply to the markup of a documents. Don't be too concerned about what a DTD is, rather just note that you need to use one! All documents must have a DTD in the document before the root element, it should always be the first line in an XHTML document.

There are 3 doctypes, Strict Transitional and Frameset.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">

The Strict Doctype should be used when you want really clean code! Although it would be very difficult to write code which will correctly validate against this. Use this together with Cascading Style Sheets.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">

This is probably what you should be using now. THis is normally used to take advantage of HTML's presentational features and also when you want to support browsers which don't understand CSS.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "DTD/xhtml1-frameset.dtd">

Use this when you want to use frames!

Minimal Document with Transitional DTD

Here is a VERY basic XHTML document with a Transitional Doctype.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Document Title</title>
<p>This is a paragraph.</p>

Do you want to know what is contained within the DTD? Click here to view XHTML1-Transitional.DTD.

Don't forget to visit:


Advertisement Sign up for free to PayBox.me today and get $25 just for joining AND earn up to $20 per day for participating.