Difference between HTML and XHTML

XHTML is HTML, and is XML

XHTML version 1.0 is almost exactly the same as HTML version 4.01. Both are current versions of HTML. The difference is that XHTML also conforms to the rules of XML.

Differences

Lower case element and attribute names

The difference between HTML and XHTML is that XHTML must also meet the requirements of XML. The first important requirement is that XML is case sensitive. XHTML meets this requirement by making all element names and attribute names lower case. In HTML you can use either upper case or lower case.
Examples:

Valid HTML, but invalid XHTML. Do NOT use these.
<UL>
  <LI> item 1 </LI>
</UL>
Valid HTML, and valid XHTML. Use these.
<ul>
  <li> item 1 </li>
</ul>

Close all container elements

All container elements must be closed in XHTML. You can sometimes get away withour closing them in HTML.
Example:

Valid HTML, but invalid XHTML. Do NOT use these.
<ul>
  <li>
  <li>
</ul>
Valid HTML, and valid XHTML. Use these.
<ul>
  <li> </li>
  <li> </li>
</ul>

Close empty elements with space slash

Some container elements do not have a closing tag. In XHTML you must close them with a space slash. The space slash is not required in HTML.
Example:

Valid HTML, but invalid XHTML. Do NOT use these.
<hr>
<br>
Valid in both HTML and XHTML.
<hr />
<br />

Do not mix up the closing tags

All element within a container elements must be closed before the container is closed. You must do this in XHTML. You should do this in HTML, but can sometimes get by with tags in the wrong order
Example:

Bad. Do NOT use this.
<b><i> This text may not work correctly. </b></i>
Good. The i element is inside the b container element
<b><i> This text will be bold italic. </i></b>

Every attribute must have a value

Every attribute you code must have a value in XHTML. A few attribute values may be omitted HTML.
Example:

Valid HTML, but invalid XHTML. Do NOT use these.
<hr noshade />
Valid in both HTML and XHTML.
<hr noshade="noshade" />

Every attribute value must be in quotes

Every attribute value must be in single quotes or double quotes in XHTML. Sometimes quotes may be omitted HTML.
Example:

Valid HTML, but invalid XHTML. Do NOT use these.
<hr width=4>
Valid in both HTML and XHTML.
<hr width='4' />
<hr width="4" />

One each of html head title body are required in XHTML

One each of html head title body are required in XHTML. Sometimes one may be omitted, or there may be two of one in HTML.
Example:

This example is valid in both HTML and XHTML.
Example:

      <html>
        <head>
          <title> sample page </title>
        </head>
        <body>
          Hello.
        </body>
      </html>
            

a DOCTYPE element is required in XHTML

A DOCTYPE element is required in XHTML. It is optional in HTML.