Home >>XHTML Tutorial >XHTML Doctypes

XHTML Doctypes

XHTML Doctypes

The XHTML specification describes three Types of Document Type Definitions (DTDs). The most widely used and the simplest one is the Transitional XHTML documents.

A list of the XHTML Doctypes:

  • Strict
  • Transitional
  • Framese

There are some XHTML elements and attributes accessible on one DTD but not on another DTD. Then you have to carefully pick your XHTML elements or attributes when writing your XHTML document. XHTML validator can also help you distinguish valid and incorrect elements and attributes.

XHTML 1.0 Strict DTD

If you choose to use Cascading Style Sheet (CSS) exclusively to stop writing any of the XHTML attributes it is recommended.

On top of your XHTML document, apply the following DTD.

Syntax:

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

XHTML 1.0 Transitional DTD

If you are intending to use several XHTML attributes and some Cascading Style Sheet assets, then this DTD should be followed and your XHTML document should be written accordingly.

You need to add the following line at the top of the XHTML document if you choose to use XHTML 1.0 Transitional DTD.

Syntax:

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

XHTML 1.0 Frameset DTD

You will do this anytime you choose to divide the browser window into two or more frames using HTML Frames.

When you choose to use XHTML 1.0 Frameset DTD, then at the top of your XHTML document you have to add the following line.

Syntax:

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

No Sidebar ads