Moving to XHTML

Creating XHTML compliant pages simply requires following a few simple rules. These rules may seem counter-intuitive or just a lot of extra work at first, but the benefits are significant and actually make coding sites much easier. Also, XHTML code can be easily validated online so you can be sure your code is correctly written.

Here are the key requirements for successful validation of your XHTML code.

  1. Declare a DOCTYPE
  2. Declare an XML namespace
  3. Declare your content type
  4. Close every tag, enclosing or non-enclosing
  5. All tags must be nested correctly
  6. Inline tags can't contain block level tags
  7. Write tags in lowercase
  8. Attributes must have values and must be quoted
  9. Use encoded equivalents for left brace and ampersand
more about these requirements

© 2004 Charlie Wyke-Smith and New Riders.