Main Rules of XHTML

This document lists the rules of XHTML.

They are taken from the standards found at: http://www.w3.org/TR/xhtml1.

  • All opening tags that contain content must have a closing tag.
  • Empty Elements must have either an end tag or terminate with a blank followed by />
  • Tags must be properly nested
  • Element and attribute names must be in lowercase letters
  • The values of attributes must be in quotation marks

XHTML enforces additional rules concerning whitespace

The following characters are defined as whitespace characters in XHTML:

  • space
  • tab
  • carriage return
  • form feed
  • Zero-width space
  • All whitespace that surrounds block elements should be removed.
  • Comments are removed entirely and do not affect whitespace handling. One whitespace character on either side of a comment is treated as two whitespace characters.
  • Leading and trailing whitespace inside a block element must be removed.
  • Line feed characters withing a block element must be converted into a space.
  • A sequence of whitespace characters must be reduced to a single space character. For example, if you have a sequence of several spaces, it will be reduced to a single space in the display.

More Guidelines (Differences between HTML and XHTML

  1. In HTML, it doesn't matter whether tags are uppercase, lowercase, or a mixture of both. In XHTML all tags must be lowercase.
  2. Closing tags are often optional in HTML but are always required in XHTML.
  3. In XHTML all attribute values must be enclosed in quotation marks.

 

 

 

 


 

 

 


UCCS Ingeniux Users' Group List: