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

the xhtml namespace · xmlns

Pixel PeteVSQuirks Mode
Pixel Pete saysThe xmlns namespace on <html> declares the document uses the XHTML vocabulary.

XML uses namespaces to disambiguate vocabularies. XHTML's root carries xmlns="http://www.w3.org/1999/xhtml", telling parsers these are XHTML elements. Namespaces also let you mix vocabularies — embedding SVG or MathML inside XHTML by giving each its own namespace.

Power-ups you unlock

Quirks Mode attacks — common mistakes

Boss battleAdd the XHTML namespace to a root element and note where SVG’s would go.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  ... XHTML elements ...
  &lt;svg xmlns="http://www.w3.org/2000/svg"&gt;...&lt;/svg&gt;</pre></body></html>
▶ Open the interactive comic issue
‹ Xhtml Validation · The Strict ParserContent-Type · Application/Xhtml+Xml ›