HTML vs XHTML

There are some changes in XHTML as compared to HTML. These changes can be categorized in three parts:


Changes in Document Structure

  • All documents must have a DOCTYPE.
  • The xmlns attribute in <html> is mandatory and must specify the xml namespace for the document.
  • <html>, <head>, <title>, and <body> are mandatory with their respective closing tags.

Changes in XHTML Tags

  • All XHTML tags must be in lower case.
  • All XHTML tags must be closed.
  • All XHTML tags must be properly nested.
  • The XHTML documents must have one root element.

Changes in XHTML Tags

  • All XHTML attributes must be added properly.
  • All XHTML attributes must be in lower case.
  • The name attribute has changed.
  • XHTML attributes cannot be shortened.
  • XHTML attribute values must be quoted.
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4.   <title>Title of document</title>  
  5. </head>  
  6. <body>  
  7.   some content   
  8. </body>  
  9. </html>