The specification that followed HTML 4.0 was XHTML 1.0, which was followed by XHTML 1.1. The most significant new change introduced with XHTML was that it required that HTML documents to also be valid Extensible Markup Language (XML) documents . The X in XHTML stands for XML. XML is another markup standard derived from SGML. XML is a language used to create other markup languages, and XHTML is one such language. The main difference from HTML is that XHTML requires documents to conform to XML’s strict rules for document structure. Whereas HTML 4 was forgiving of unclosed elements, XML requires that every tag be closed, every attribute have value, and more.
Technically, XHTML and HTML 4 were very similar. The actual tags and attributes are almost the same, but the XML rules required large changes to many websites.
While XHTML has been superseded by HTML5, most websites that currently exist were built using XHTML. If you’re working on a site that was built with XHTML, you must adhere to a few rules if you want your HTML markup to be valid XHTML. All of these rules are a direct result of the fact that to be valid, an XHTML document must be valid XML as well. Here’s a list:
- All the tags in your document must be lowercase.
- Any tags that do not have closing tags must be closed using a slash after the tag name. So the <br> tag would be written as <br /> .
- All attributes must have a value. XHTML requires that you use the attribute name as the value in these cases. So they follow the form attribute=”attribute” .