Skip to main content

XHTML Doctypes

The XHTML standard defines three Document Type Definitions (DTDs). The most commonly used and easy one is the XHTML Transitional document.

XHTML 1.0 document type definitions correspond to three DTDs:

  • Strict
  • Transitional
  • Frameset
note

Be careful which doctype you choose: some XHTML elements and attributes available in one DTD may not be available in another DTD.

note

The doctype definition must be at the beginning of the XHTML document!

XHTML 1.0 Strict

If you are planning to use Cascading Style Sheet (CSS) strictly and avoiding to write most of the XHTML attributes, then it is recommended to use this DTD. A document conforming to this DTD is of the best quality.

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

XHTML 1.0 Transitional

If you are planning to use many XHTML attributes as well as few Cascading Style Sheet properties, then you should adopt this DTD and you should write your XHTML document accordingly.

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

XHTML 1.0 Frameset

You can use this when you want to use HTML 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">
note

You can use any DTD to write your XHTML document; if it is a valid XHTML document, then your document is considered a good quality document.