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

xhtml doctype · the required header

Pixel PeteVSQuirks Mode
Pixel Pete saysXHTML pages declare a DOCTYPE that names the exact DTD version they follow.

An XHTML 1.0 page opens with a long <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "…dtd"> that points at a Document Type Definition. The DTD defines which elements and attributes are legal. This verbose doctype is one of XHTML's signatures — and a relief that HTML5 simplified it to just <!doctype html>.

Power-ups you unlock

Quirks Mode attacks — common mistakes

Boss battleIdentify the parts of an XHTML 1.0 Strict doctype line.

Example code

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>xhtml doctype</title>
<style type="text/css">body{background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px}</style>
</head><body><p>this page declares an XHTML 1.0 Strict doctype.</p></body></html>
▶ Open the interactive comic issue
‹ Xhtml Syntax Rules · The Five MustsAll Tags Lowercase · The Case Rule ›