Learning Resources
 

DTD (Document Type Declaration)


A Document Type Definition (DTD) is the specification by which XHTML documents are classified.
Each document type definition specifies what type of document an XHTML document will be.

    Transitional - XHTML documents that use deprecated elements or attributes.
    Frameset - XHTML documents that use frames (can also include deprecated elements or attributes like the transitional document type).
    Strict - XHTML documents that include no deprecated elements or attributes, and no frames.

Every XHTML document you create will be one of the above types.

Specifying a document type definition
Now that you know what the three document types are, how do you go about classifying your XHTML documents accordingly?
A document type definition is specified with the declaration, with each document type including different data for it.

Although a document type definition is technically not required for a functioning webpage (though you must have it if you want your pages to validate with an XHTML validator!), it is good practice to always include it in your code. As you learn to build webpages, get into the habit of always including the document type definition in your code.

An XHTML document consists of three parts - definition, section
, section.
XHTML document core structure:
..... .....
Example:
Specifying a document type definition

Content



In the above example, the line of code that specifies the document type definition is:


The declaration must be the first line of code in an XHTML document, even before the tag.

Transitional documents
The transitional document type definition specifies an XHTML document that uses some deprecated elements or attributes such as the tag, and can also be used for documents that will be displayed in browsers that do not support CSS.
Transitional document:
Transitional document type This is a transitional HTML document

Frameset documents
The frameset document type definition specifies an XHTML document that uses frames to display one or more pages at the same time in the browser window and can also include deprecated elements or attributes (like the transitional document type definition). But unlike the transitional document type definition, the frameset document type definition uses the tag instead of the tag.
Frameset document:
Frameset document type

Strict documents
The Strict document type definition specifies an XHTML document that includes no deprecated elements or attributes such as the tag, and no frames.
Strict document:
Strict document type

Content