XHTML

Home | About | Books | Poems | Photos | XHTML | Links | CSS | Anecdotes

Convert - HTML to XHTML



The Doctype

The first change to make on your page is the Doctype. When using HTML it is good practice to add a Doctype to the beginning of the page like this.

This was optional in HTML, XHTML requires you to add a Doctype. There are three doctypes in use.

Strict - This is used mainly when the markup is very clean and there is no 'extra' markup to aid the presentation of the document. This is best used if you are using CSS (Cascading Style Sheets) for presentation.

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

Transitional - This should be used if you want to use presentational features of HTML in your page.

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

Frameset - This should be used if you want to have frames on your page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">


The Main Changes

There are several changes to be made from HTML to XHTML:

  • All documents must be properly formed
  • All documents must have a doctype
  • All tags must be in lower case
  • All tags must be closed
  • All attributes must be added properly
  • All tags must be properly nested
  • Attributes cannot be shortened
  • The name attribute has changed

XHTML (W3C)

Valid XHTML 1.0!

Email




Last updated on 3 September, 2006   Copyright   'Banjo' UK