HTML has ruled for almost a decade as the main markup language for websites. Even though some of the old school programmers use HTML but the truth is that the next level is XHTML. HTML stands for Hyper Text Markup Language and it basically describes the structure of text information including images in a web document. XHTML stands for Extensible Hyper Text Markup Language and most of its features are similar to that of HTML and is known to be the successor to HTML.

Most Important Differences Between HTML and XHTML
There are the most important differences between HTML and XHTML and they can be classified under MIME types, Syntax and Parsing.
MIME Types
MIME stands for Multipurpose Internet Mail Extensions and in HTML you need to use text/html. In XHTML, you need to use XML MIME type like application/xhtml+xml or application/xml. Here are some HTML MIME types:

Parsing and Syntax
The biggest difference between the two is that HTML uses its own parsing requirement while XHTML uses XML parsing requirement. Let’s look at each feature and the difference in each feature in HTML and XHTML.
Parsing Modes
HTML: In HTML, three different parsing modes have been defined and they are quirks mode, no quirks mode, and limited quirks mode.
XHTML: There is only one parsing mode defined, which is basically based on XML parsing rules.
Case Sensitivity
HTML: No elements are case sensitive.
XHTML: Every element is case sensitive and must be used in lower case only.
Error Handling
HTML: In HTML, there is no well-formedness constraint and hence there are no errors that are fatal
XHTML: In XHTML, well-formedness errors are all fatal
Character Encoding
HTML: In HTML, the XML declaration is treated like a bogus comment or in other words it is forbidden. Even though, you can use the charset attribute with the meta element.
XHTML: In XHTML, XML declaration is used for specifying the character encoding. The default character encoding is UTF-8 or UTF-16.
Namespaced Element
HTML: In HTML, namespaced prefixes are not allowed. Foreign elements are not treated as if they belong to another namespace and are displayed by default as inline elements.
XHTML: In XHTML, the namespace needs to be declared for HTML elements. You can use foreign elements independent of HTML elements.
Xlink attributes
HTML: In HTML, Foreign elements can use attributes like xlink:arcrole, xlink:actuate, xlink:role, xlink:href, xlink:title, xlink:show, and xlink:type. You can use only xlink as prefix.
XHTML: Based on conformance rules that have been defined by Namespaces in XML, XLink attributes can be specified on foreign elements. You can use any prefix.

Attributes
HTML: In HTML, names are not case sensitive and it allows attribute minimization.
XHTML: In XHTML, names are case sensitive and it doesn’t allow attribute minimization. All attribute values must be quoted.
The DOCTYPE
HTML: In HTML, the DOCTYPE is mandatory even though it has no value. DOCTYPE is treated case insensitively and all HTML documents should use <! DOCTYPE html >
XHTML: In XHTML, you can even use an HTML5 DOCTYPE or any custom DOCTYPE.

All tags within XHTML must be properly closed
While using XHTML you will need to close any tags which is opened and use short tags properly. Otherwise the page may render differently on different browsers as they will close those tags as per their anticipation.
CDATA Comment
HTML: <![CDATA[...]]> is not a valid CDATA comment. Anything that goes within this comment is considered as content data.
XHTML: <![CDATA[...]]> is a valid CDATA comment. If the content within this section contains any “]]>” then it can give unexpected errors.
Wrap Up
So these are some of the major differences between HTML and XHTML which every web designer should be aware of. Cross browser compatibility is one of the considerable enhancements on XHTML 1.1, a subset of which even now supports most advanced mobile browser and is known as XHTML Mobile Profile (XHTML MP).
The Geeks Club Apple, iOS, Android, Smart phones, Social Media and the Internet
