freecoding.school100% FREE · NO SIGNUP
Markup CityISSUE #39 of 39

html vs xhtml · the strictness divide

Tagg the BuilderVSThe Unclosed Tag
Tagg the Builder saysHTML5 is forgiving; XHTML is HTML written under strict XML rules. HTML5 won, but the discipline still teaches good habits.

XHTML reformulated HTML as strict XML: every tag lowercase, every tag closed (even <br />), every attribute quoted, perfect nesting. A single error meant the whole page refused to render.

HTML5 chose pragmatism — browsers recover from mistakes — and that's why it won. But writing HTML as if it were XHTML (closing tags, quoting attributes) gives you cleaner, more predictable markup. Take the discipline, skip the brittleness.

Power-ups you unlock

The Unclosed Tag attacks — common mistakes

Boss battleWrite the same small snippet twice — once HTML5-loose, once XHTML-strict (lowercase, quoted, self-closed) — and compare.

Example code

<!doctype html>
<html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;font-size:13px">
  <p>html5 loose:  &lt;IMG SRC=pic.png&gt;&lt;BR&gt;</p>
  <p>xhtml strict: &lt;img src="pic.png" /&gt;&lt;br /&gt;</p>
  <p style="color:#8aff9d">write the strict version by habit — it is cleaner.</p>
</body></html>
▶ Open the interactive comic issue
‹ Url Encoding · Safe Characters