XHTML Validation

XHTML documents are validated based on the Document Type Declaration.

Validate XHTML through DTD

XHTML documents are validated based on the Document Type Declaration (DTD). Only by adding the correct DTD at the first line of the file, the XHTML file will be correctly validated.

The Strict DTD includes elements and attributes that are not deprecated or not present in frame structures:

!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"

The Transitional DTD includes everything from the Strict DTD, plus those deprecated elements and attributes.

!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

The Frameset DTD includes everything from the Transitional DTD, plus frames.

!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"

This is a simple 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>

Use the W3C validator to test your XHTML

Enter your website URL in the text box below: