Best Markup for text/html
XHTML sent as text/html can only do what HTML can. HTML uses less filesize, is easier to author and better suited to the web. HTML wins.
Analysis
- An XHTML 1.0
DOCTYPEcannot make browsers processtext/htmlusing an XML parser. - Neither can a processing instruction nor other parts of an XML Prolog.
- XHTML is not, strictly speaking, compatible with HTML:
- XHTML 1.0 Appendix C is not normative, so it cannot give conformance requirements.
- XML Namespaces are undefined in
text/html, so HTML cannot be extended with them.
- Technical benefits of XHTML which are false:
- XHTML 1.0 is limited to the elements and attributes of HTML 4.01. There’s nothing new.
- Mobile browsers don’t use XML parsers. It does not help interoperability.
- XHTML is less efficient by using more filesize than the equivalent HTML.
- Both require writing void elements a specific way. HTML’s way is shorter.
- HTML is well-formed when valid. It uses less syntax and more logic to achieve this.
- Both are equally compatible with CSS.
- Theoretical benefits of XHTML which are false:
- XHTML Modularisation 1.1 permits legacy markup. It isn’t ‘more semantic’.
- XHTML websites are rarely XML compatible. Therefore, XML did not clean up the web.
- XHTML syntax is not pretty or logical. Compare
selected="selected"withselected. - XHTML is harder to learn due to lots of restrictions and complexities.
- Validating to HTML 4.01 Strict enforces more best practices than XHTML 1.0 Transitional.
- Viable web browsers must support HTML because that’s what the web uses.
- HTML has good support, widespread use and active development. XHTML2 does not.
Recommendation
Use HTML 4.01 Strict. It is better than XHTML for text/html resources.