HTML and XHTML

XHTML is really just a newer version of HTML. The X stands for extendable, which allows new tags to be defined. XHTML also has stricter rules for coding pages. Here are the major restrictions:

  • All tags should be in lower-case.
  • All tags must be closed (either with a closing tag or ending the tag with "/>"
  • Attribute values must be in quotes.
  • XHTML tags must be properly nested.
  • The DOCTYPE should be specified at the beginning of the document. This declaration was used for xhtml:
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

HTML 5

While it hasn't been officially adopted yet, many browsers now support HTML 5, the next version of HTML. It supports a variety of new tags (e.g. footer, article, section, nav) for indicating logical elements on a page. It is also less strict than XHTML and has a simplified Doc Type declaration: <!DOCTYPE html>

For our class projects, you may follow the HTML 5 conventions.

The DOCTYPE should be specified at the beginning of the document. For html5, just specify: <!DOCTYPE html>