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"
Do you want to know what is contained within the DTD? Click here to view XHTML1-Transitional.DTD.
Don't forget to visit: