XHTML DTD
- Previous Page XHTML Syntax
- Next Page XHTML HowTo
XHTML defines three types of file type declarations.
The most commonly used is XHTML Transitional.
The <!DOCTYPE> is mandatory.
An XHTML document has three main parts:
- DOCTYPE
- Head
- Body
The basic document structure is as follows:
<!DOCTYPE ...> <html> <head> <title>... </title> </head> <body> ... </body> </html>
In an XHTML document, the document type declaration is always located at the first line.
An example of XHTML
This is a simple (minimized) XHTML document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>simple document</title> </head> <body> <p>a simple paragraph</p> </body> </html>
The document type declaration defines the type of the document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The rest of the document is similar to HTML:
<html> <head> <title>simple document</title> </head> <body> <p>a simple paragraph</p> </body> </html>
Three types of document type declarations
- DTD specifies the syntax of web pages using Generalized Markup Language (SGML).
- Generalized Markup Language such as HTML should use DTD to specify the rules for the tags applied to a specific document, including a series of element and entity declarations.
- In the document type declaration or DTD of Generalized Markup Language (SGML), XHTML is described in detail.
- XHTML DTD uses an accurate, computer-readable language to describe the syntax and semantics of valid XHTML markup.
There are three types of XHTML document types:
- STRICT (strict type)
- TRANSITIONAL (transitional type)
- FRAMESET (frame type)
Three types of XML document types in XHTML 1.0
XHTML 1.0 specifies three types of XML document types to correspond to the above three DTDs.
XHTML 1.0 Strict
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
">
Use in this case: require clean markup, avoid confusion in presentation. Use in conjunction with CSS.
XHTML 1.0 Transitional
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">
Use in this case: When you need to use the presentation features of HTML and when you need to write XHTML for browsers that do not support cascading style sheets.
XHTML 1.0 Frameset
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
>
Use in this case: When you need to split the browser window into two parts or more frames using HTML frames.
- Previous Page XHTML Syntax
- Next Page XHTML HowTo