XHTML ( EXtensible HyperText Markup Language), developed by World Wide Consortium (W3C) in 2000, is the more extended version of the popular HTML. It is the same HTML but defined as an XML application, which combines the advantages of both HTML and XML.

XHTML retains all the features of HTML but introduced more strict rules for creating pages, which allows you to make sites independent of the display device and browser. It means that the site will be correctly displayed in all modern browsers and platforms like computers, smartphones, PDAs, etc.

XHTML is supported by all modern browsers.

Difference between HTML and XHTML

  1. You should always use <!DOCTYPE ....>

    An XHTML document must include an XHTML Doctype Declaration. Other required elements are the <html>, <head>, <title>, and <body> tags.

    Example of XHTML Document With Required Elements:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <title>Title of the document</title>
        Content of the page
  2. You should insert XHTML elements properly. In an XHTML document, you cannot nest elements improperly. It should look like this:
     <em>This text is bold and italic</strong>
  3. Unlike HTML, where we can sometimes omit the closing tag, in XHTML the closing tag is required always and everywhere:
    A break: <br/>
    A horizontal rule: 
    An image: <img src="smile.gif" alt="Always smile" />
  4. Lowercase and uppercase tags are distinguished in XHTML. To avoid confusion, all tags, as well as their attributes must be typed in lowercase:
      <p>Some paragraph</p>
  5. You must write XHTML attributes in lower case, like this:
    <table width="100%">
  6. You must put the attribute values in quotes, like this:
    <table width="100%">
  7. You cannot minimize attributes. The abbreviated attribute is not assigned a value. An attribute can be assigned an attribute value that matches the name. It shouldn’t look like this:
    <input type="checkbox" name="flower" value="rose" checked />

    Instead, it must look like this:

    <input type="checkbox" name="flower" value="rose" checked="checked" />
  8. Instead of the name attribute you’ve better use id. In XHTML the name is partially obsolete, that’s why it’s recommended to use id attribute.

Benefits of XHTML

  • The fact that in XHTML all tags must be closed and nested correctly makes the code look much cleaner.
  • XHTML uses less bandwidth, which reduces cost especially if your site has thousands of pages.
  • Thanks to being well-formed, XHTML documents are easily transported to wireless devices, Braille readers and other specialized web environments.
  • XHTML works with CSS to create web pages easily.


HTML is the main markup language for creating web pages, while XHTML, as mentioned above, is the extended version of it. HTML is an application of Standard Generalized Markup Language (SGML), while XHTML is an application of XML. HTML is extended from SGML, and XHTML from XML and HTML. HTML was created by Tim Berners-Lee in 1987(Wikipedia)and XHTML was proposed by World Wide Consortium in 2000 (Wikipedia). And the last difference between these two is the flexible framework requiring lenient HTML specific parser in case of HTML and restrictive subset of XML which needs to be parsed with standard XML parser in case of XHTML.


XHTML is case sensitive, while HTML5, as well as HTML, are not. XHTML has much more complex doctypes than HTML5. The next difference is browser compatibility: HTML5 is supported by all the browser, while XHTML is not. HTML5 is better suited for mobile devices, whereas XHTML is better suited for computer screens. And one more difference is that HTML5 is more lenient that XHTML.

Practice Your Knowledge

What are some characteristics of XHTML (Extensible Hypertext Markup Language)?

Quiz Time: Test Your Skills!

Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.

Do you find this helpful?