Difference Between XHTML and HTML

HTML and XHTML are completely differ from each other in document structure,elements and attribute format.

XHTML

->XHTML is proposed by W3C Recommendation in 2000.

->It is developed by W3C(World Wide Web Consortium).

->XHTML files are saved with .xhtml, .xht, .xml , .html and .htm extension.

->XHTML is an XML application.
Eg:
  1. <html>
  2. <head>
  3. <title>This is an XHTML page </title>
  4. </head>
  5. <body>
  6. <p> This is my first XHTML page </p>
  7. </body>
  8. </html>
As shown in the above example, there is both tag ie. starting tag as well as ending tag (ie <p> and </p>). That means it follows all principles.

HTML

->HTML is proposed by Tin-Berners-Lee in 1987.
->HTML is developed by W3C and WHATWG.
->HTML files are saved with .html and .htm extension.
->HTML is an SGML (Standard Generalized Markup Language) application.
Eg:
  1. <html>
  2. <head>
  3. <title>This is an XHTML page </title>
  4. </head>
  5. <body>
  6. <p> This is my first XHTML page
  7. </body>
  8. </html>
As shown in the above example, there is no ending tag ie </p> that means it doesn't follow the rule. That's why we need the XHTML instead of HTML.