Struggling for Competence

XHTML - What's that all about?

XHTML is a reformulation of HTML as XML. It aims to make a clean separation between document structure and presentation. To make XHTML you have to follow these rules:

Most of these rules are basically saying that the document must be valid xml, but with the added twist of making it work with older browsers. You can check the validity of your XHTML using the W3C validator.

Html, head, title and body are mandatory

In XHTML the html, head, title and body elements are mandatory. So a minimal html document is:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>Controversial Title</title>
  </head>
  <body>
    <h1>Interesting Content</h1>
  </body>
</html>

Difference between Strict and Transitional

The strict doctype removes the presentation elements and attributes from the document. In particular the <center>, <font> and <iframe> elements may not be used.

Special Rules

The general rule is that:

There are however an number of special rules: