freecoding.school100% FREE · NO SIGNUP
The Old NetISSUE #19 of 60

xhtml 5 · the polyglot subset

Pixel PeteVSQuirks Mode
Pixel Pete saysXHTML5 is HTML5 written in strict XML syntax — the modern way to use XHTML.

HTML5 has two serializations: the usual HTML syntax, and an XML one called XHTML5 (HTML5 served as application/xhtml+xml). It uses the simple <!doctype html>, the XHTML namespace, and strict XML rules. A polyglot document is written to be valid as both — useful when an XML toolchain must consume your pages.

Power-ups you unlock

Quirks Mode attacks — common mistakes

Boss battleNote the two changes that turn an HTML5 page into valid XHTML5.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>HTML5  → &lt;!doctype html&gt;, served text/html
XHTML5 → same + xmlns + self-closed voids,
         served application/xhtml+xml</pre></body></html>
▶ Open the interactive comic issue
‹ Xhtml 2.0 · The Version That Never ShippedXml Stylesheets · Linking Xslt ›