Slide 3.9: XHTML syntax (cont.)
Slide 3.11: XHTML DTD (cont.)
Home

XHTML DTD


The XHTML standard defines three Document Type Definitions. The most common is the XHTML Transitional.

<!DOCTYPE> Is Mandatory.
An XHTML document consists of three main parts:
  • the DOCTYPE,
  • the Head, and
  • the Body.
 <!DOCTYPE ...>
  <html>
   <head>
    <title>... </title>
   </head>
   <body> ... </body>
 </html>

The basic document structure is given on the above. The DOCTYPE declaration should always be the first line in an XHTML document.

An XHTML Example
This is a simple (minimal) 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 DOCTYPE declaration defines the document type:

 <!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 looks like HTML:
 <html>
  <head><title>simple document</title></head>
  <body><p>a simple paragraph</p></body>
 </html>


Demonstration
The following demonstration shows how the script of HTML is displayed on the Web.