Saturday, October 6, 2007

XHTML quick reference

  • XHTML elements should be nested correctly.
  • Always close tags.
  • Elements should be in lower case.
  • Tags <html>, <head> and <body> are mandatory in XHTML.
  • Enclose all attributes values in quotes.
  • Do not use minimization (not only in HTML but in all programming languages).
  • Utilize id attribute for naming elements instead of name attribute.
  • All XHTML documents should have a DOCTYPE declaration.

There are three kinds of DOCTYPE as follows:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
  3. <!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

No comments: