XHTML/DTD (Document Type Definition)
Introduction
editAn XHTML DTD describes the allowed syntax and grammar of XHTML markup. Every XHTML document must start with a DTD declaration and a line of code that declares that you are starting to write XHTML code.
This is the mandatory minimum way to start an XHTML document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org
/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
The Three Document Type Definitions
editThere are currently three XHTML 1.0 document types:
- Strict
- Transitional
- Frameset
XHTML 1.0 Strict
editThis is used when the user wants a clean markup, free of presentational clutter. Use this in conjunction with Cascading Style Sheets.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org
/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Transitional
editUse this when taking advantage of XHTML's presentational features and when you want to support browsers that do not understand Cascading Style Sheets. This is the one that is favored to use among developers and is used commonly.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org
/TR/xhtml1/DTD/xhtml1-transitional.dtd">
XHTML 1.0 Frameset
editUse this when you want to use XHTML Frames to partition the browser window into two or more frames.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-frameset.dtd">
XHTML 1.1
edit<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
XHTML 2.0
editXHTML was a working draft, but its development was halted in favor of HTML 5.0. Even though the specification will not be completed, its doctype is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml2.dtd">