Differences between HTML and XHTML

Posted on May 27, 2014, 8:30 am by about-dev.com

The first two posts of this category where about HTML and XHTML and I consider is necesary to underline the main differences between these two web technologies.

So, I found these differences at syntax level and behavioral level:

1. HTML uses pseudo-SGML syntax, while XHTML uses a XML syntax.
2. XHTML requires that we follow the XML syntax rules (see them here).
3. Shorthand minimization of attributes and elements is not allowed anymore in XHTML, while in HTML we could use it.

HTML attribute shorthand: attributeName
XHTML attribute shorthand: attributeName="attributeValue"

4. Behavior on parse error differe from HTML to XHTML: a fatal parse error in XML (an incorrect tag structure) causes document processing to be aborted.
5. HTML doesn't know to work with namespaces, while XHTML does.
6. There are some implications in JavaScript and CSS behaviour because of the XHTML case-sensitivity:
 - CSS selectors are case-sensitive
 - for JavaScript I quote "JavaScript processing is a little different in XHTML, with minor changes in case sensitivity to some functions, and further precautions to restrict processing to well-formed content"

The list remains open, because things in web are changing wery fast :).

Related articles:

Leave a Comment:


Blog Search

Popular Blog Categories


Want to be informed about latest posts? Subscribe to our newsletter