This is the second installment of a series of blog posts to discuss HTML, XML and XHTML. An often asked question is “What are the differences between HTML and XHTML?” But actually, a much more interesting question is “What do HTML and XHTML have in common?”
It’s all about the content
HTML and XHTML are both content markup languages. That is, in both cases, the most important thing is that they are describing some content being used for communication. The content is marked up so that computer software – especially browsers – can determine the significance of the content and render it appropriately.
HTML and XHTML have the same rules about content, and the same markup constructions. Because of its history, HTML allows some outdated markup to be accepted which XHTML does not.
They delegate styling to CSS
Both HTML and XHMTL delegate the styling of pages to CSS. The same CSS. There isn’t one CSS for HTML and another for XHTML, although a few of the rules are interpreted slightly differently in the two cases.
They are W3C standards
Both HTML and XHTML are technical recommendations from the W3C – so called “Web Standards”. Theoretically, any valid HTML or XHTML document should be accepted by all “user agents” out there – from browsers and screen readers to search engine bots.
They have similar appearance
Both HTML and XHTML use SGML as a reference base, and as such, they look very similar, especially when you consider that the valid markup tags in the two languages are the same. There are superficial syntactic differences, particularly in terms of HTML’s tolerance for tags in different cases, and XHTML’s stricter rules on closing tags.
In Summary
HTML and XHTML are very similar in purpose, intent, layout and appearance. XHTML has a more consistent syntax, while HTML can be shorter and is more tolerant.