What is the difference between HTML and XHTML?
The differences between HTML and XHTML are small. As the rules of XHTML are based on those of XML, the same exceptionally strict rules apply as with XML. The major differences are outlined below.
The most important difference between the two markup languages is that HyperText Markup Language, or HTML, is an application of SGML (Standard Generalized Markup Language)1 and allows an author to omit certain tags and use attribute minimization.
The Extensible HyperText Markup Language, or XHTML, is an application of XML (Extensible Markup Language). It doesn’t permit the omission of any tags or the use of attribute minimization. XHTML documents must start with an XHTML DocType declaration.
The following chart shows what the differences between HTML and XHTML are:
|HTML 4.01||XHTML 1.0|
|Forgiving||Requires discipline and attention to detail|
|Correct nesting required in theory||Correct nesting absolutely required|
|Some end tags optional||All end tags required|
|No end tag for empty content model||Even empty content model requires end tag|
|Case insensitive||Lowercase only|
|Some attribute values needn’t be quoted||All attribute values must be quoted|
|Certain “valueless” attribute values are OK||All attributes must have values|
|Less sensitive to special characters||More sensitive to special characters|
|Ubiquitous name attribute||Id attribute preferred to name, mostly|