Last modified on 16 February 2014, at 22:11

XHTML/DTD (Document Type Definition)

IntroductionEdit

An 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 DefinitionsEdit

There are currently three XHTML 1.0 document types:

  • Strict
  • Transitional
  • Frameset

XHTML 1.0 StrictEdit

This 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 TransitionalEdit

Use 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 favoured to use amongst 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 FramesetEdit

Use 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.1Edit

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

XHTML 2.0Edit

XHTML was a working draft, but its development was halted in favour 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">