XHTML document type definition
There are three document type definitions in XHTML. Each document type definition specifies what type of document an XHTML document will be.
This lesson focuses on:
- Specifying a document type
- The transitional document type
- The frameset document type
- The strict document type
Specifying a document type
A document type is specified with the <!DOCTYPE> declaration.
NOTE: The <!DOCTYPE> declaration is mandatory and should always be the first thing in an XHTML document.
NOTE: Although a document type definition is technically not required for a functioning webpage, it is good practice to always include it in your webpages. As you learn to build webpages, get into the habit of always including the document type definition in your code.
Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Specifying a document type</title>
</head>
<body>
document content
</body>
</html>
The line of code that specifies the document type is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The rest of the XHTML document:
<html> <head> <title>Specifying a document type</title> </head> <body> document content </body> </html>
The transitional document type
The transitional document type specifies an XHTML document that uses some deprecated features such as HTML's <font> tag, and can also be used for documents that will be displayed in browsers that do not support Cascading Style Sheets.
Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Specifying a document type</title> </head> <body> document content </body> </html>
The frameset document type
The frameset document type specifies an XHTML document that uses frames to display one or more pages at the same time in the browser window. The Frameset document type definition is similar to the Transitional document type definition, but unlike the Transitional document type definition, the Frameset document type definition uses the <frameset> tag instead of the <body> tag.
Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html> <head> <title>Specifying a document type</title> </head> <frameset cols="50%, 50%"> <frame src="frame1.html" /> <frame src="frame2.html" /> </frameset> </html>
The strict document type
The strict document type specifies an XHTML document that contains really clean markup with no presentational clutter, and does not use any deprecated features such as HTML's <font> tag. The strict document type should be used together with Cascading Style Sheets.
Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Specifying a document type</title> </head> <body> <h1>Content</h1> </body> </html>




