The Most Important Differences:
* XHTML elements must be properly nested
* XHTML elements must always be closed
* XHTML elements must be in lowercase
* XHTML documents must have one root element
* XHTML is XML, which means that the syntax rules are slightly different.
* There are things you can do in XHTML which you cannot do in HTML.
* There are things you can do in HTML which you cannot do in XHTML.
* There are differences concerning CSS.
* There are differences concerning client-side scripting (e.g., JavaScript).
Differences in Syntax Rules
* XHTML is case-sensitive, HTML is not. All tags and attributes must be lowercase in XHTML.
* XHTML, being XML, must be well-formed. Every element must have an end tag, or use the self-closing tag syntax. HTML allows some end tags and even some start tags to be omitted.
* If an XML parser encounters a well-formedness error, it must abort. An SGML or HTML parser is expected to try to salvage what it can and keep going.
* All attributes must have a value in XHTML. HTML allows some attributes (e.g., selected) to be minimised.
* All attribute values must be surrounded by double or single quotes. HTML allows quotes to be omitted if the value contains only alphanumeric characters (and some others).
* The comment syntax is more limited in XHTML, but that's rarely an issue for most designers/developers.
Things You Can Do in XHTML But Not In HTML
* Use CDATA sections (<![CDATA[ … ]]>). That's useful if you have content with lots of literal characters that otherwise need to be escaped.
* Use PIs (processing instructions), e.g., to link to a style sheet:
<?xml-stylesheet type="text/css" href="style.css" media="screen"?>
* Include elements from other XML namespaces (see below).
* Use the ' character entity.
Things You Can Do in HTML But Cannot Do in XHTML
* 'Hide' the contents of style or script elements with SGML comments (<!--…-->).
* Create parts of the page dynamically with JavaScript while the document is still loading (e.g., using document.write()).
* Use named character entities (e.g., ) other than the four predefined ones: <, >, & and ".
* Use the .innerHTML property with JavaScript (technically this is non-standard even in HTML).
Differences Concerning CSS
* Element type selectors in CSS are case sensitive for XHTML, but not for HTML.
* In HTML, the properties background-color, background-image and overflow on the BODY element will be applied to the root element (HTML) unless specified for that element also. That is not the case for XHTML.