Tuesday, 16 December 2008

Differences Between XHTML And HTML

First of all, when we are talking about XHTML it is actually XHTML 1.0. When using VS2008 to create HTML/ASP.NET page the default DOCTYPE details are:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The Most Important Differences between XHTML and HTML are:
  • XHTML elements must be properly nested.
  • XHTML elements must always be closed, for example "</p>". If tag is empty it should be self-closed, like this: "<br />".
  • XHTML elements must be in lowercase, including property names.
  • XHTML property value should always be quoted.
  • Use id instead of name to identify a XHTML element.
  • the script should be embraced by CDATA section.

No comments: