Best Markup for text/html

First published on 2006-07-25. Updated on 2008-01-11, 2009-03-13, 2009-09-27, 2009-11-01, 2010-05-23 and 2011-09-30.

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

  1. An XHTML 1.0 DOCTYPE cannot make browsers process text/html using an XML parser.
  2. Neither can a processing instruction nor other parts of an XML Prolog.
  3. XHTML is not, strictly speaking, compatible with HTML:
    1. XHTML 1.0 Appendix C is not normative, so it cannot give conformance requirements.
    2. XML Namespaces are undefined in text/html, so HTML cannot be extended with them.
  4. Technical benefits of XHTML which are false:
    1. XHTML 1.0 is limited to the elements and attributes of HTML 4.01. There’s nothing new.
    2. Mobile browsers don’t use XML parsers. It does not help interoperability.
    3. XHTML is less efficient by using more filesize than the equivalent HTML.
    4. Both require writing void elements a specific way. HTML’s way is shorter.
    5. HTML is well-formed when valid. It uses less syntax and more logic to achieve this.
    6. Both are equally compatible with CSS.
  5. Theoretical benefits of XHTML which are false:
    1. XHTML Modularisation 1.1 permits legacy markup. It isn’t ‘more semantic’.
    2. XHTML websites are rarely XML compatible. Therefore, XML did not clean up the web.
    3. XHTML syntax is not pretty or logical. Compare selected="selected" with selected.
    4. XHTML is harder to learn due to lots of restrictions and complexities.
    5. Validating to HTML 4.01 Strict enforces more best practices than XHTML 1.0 Transitional.
    6. Viable web browsers must support HTML because that’s what the web uses.
  6. 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.