Tutorials
CSS
Web Design
XHTML
Javascript
PHP

XHTML
What's XHTML?
XHTML Syntax
XHTML Doctype Definition


More information

(X)HTML Guides
XHTML Doctype

What is a 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."

Basically, the doctype specifies the rules that apply to the markup of a documents. 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.



XHTML-1.0-Strict

<!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.



XHTML-1.0-Transitional

<!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 preseatational features and also when you want to support browsers which don't understand CSS.



XHTML-1.0-Frameset

<!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"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Document Title</title>
</head>
<body>
<p>This is a paragraph.</p>
</body>
</html>


For further information, please contact: http://www.w3.org/TR/xhtml1/


Discuss this in the Forum  

Search HeaphyDesigns



Stored Pages



Change Site Style
Select a style for the site:




More information