← Back to Computer Science-Full Course (Plus-2)

Difference between XHTML and HTML

HTMLXHTML
HTML stands for Hypertext Markup Language.XHTML stands for Extensible Hypertext Markup Language.
It was developed by Tim Berners-Lee.It was developed by W3C i.e World Wide Web Consortium.
It was developed in 1991.It was released in 2000.
It is extended from SGML.It is extended from XML and HTML.
The format is a document file format.The format is a markup language.
All tags and attributes are not necessarily to be in lower or upper case.In this, every tag and attribute should be in lower case.

What is XHTML?

XHTML (Extensible HyperText Markup Language) is a stricter version of HTML that follows the rules of XML. It was recommended by the W3C in 2000.

Rules of XHTML

  • All tags must be written in lowercase.
  • Every tag must be closed, e.g. <p>…</p>.
  • Empty tags must be self-closed, e.g. <br /> and <img src=”a.jpg” alt=”” />.
  • Tags must be properly nested: <b><i>text</i></b>.
  • Attribute values must be in quotes.
  • Attributes cannot be minimised: write checked=”checked”, not just checked.
  • A DOCTYPE declaration is required.

HTML vs XHTML

  • HTML is based on SGML; XHTML is based on XML.
  • HTML is not case-sensitive; XHTML tags must be lowercase.
  • In HTML some closing tags can be skipped; in XHTML every tag must be closed.
  • HTML browsers ignore many mistakes; XHTML documents must be well-formed.
  • HTML files use .html/.htm; XHTML files may use .xhtml.

Important Questions

Q. What is XHTML?
Ans. XHTML is a stricter, XML-based version of HTML in which documents must be well-formed.

Q. Write any three rules of XHTML.
Ans. Tags must be lowercase, every tag must be closed, and attribute values must be in quotes.

Q. How is the <br> tag written in XHTML?
Ans. <br />