Home     SSI Lab     CSS Templates     CSS     Htaccess     Web Design     XHTML

XHTML Tutorials

graphic-img   

SSI-D HOME

SSI LAB

CSS Templates

CSS

.Htaccess

Web Design

(X)HTML

Introduction

HTML-Kit

Resources





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.



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 presentational 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>


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




Don't forget to visit:

http://www.w3.org/TR/xhtml1/




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