The Minimal HTML Document
HTML (HyperText Markup Language) is the content layer of the Web. It defines the structure and meaning of web content. Here's the minimal correct HTML document:
HTML vs. XHTML: The Strictness Spectrum
In the early 2000s, the W3C tried to make HTML stricter by reformulating it as XML (XHTML). The key differences:
| Feature | HTML5 | XHTML |
|---|---|---|
| Tag case | <DIV> and <div> are the same |
Must be lowercase: <div> |
| Closing tags | <br>, <img ...> (optional close) |
Must self-close: <br />, <img ... /> |
| Attributes | checked, disabled (boolean OK) |
Must have values: checked="checked" |
| Error handling | Browser guesses and recovers | Parser stops on first error (yellow screen of death) |
Live demos:
- helloxhtml5.html — XHTML served as HTML (browser is forgiving)
- helloxhtml5.xml — XHTML served as XML (browser enforces strict parsing)
Browser Error Tolerance
One of the most remarkable features of HTML is browser forgiveness. Browsers will render almost anything, no matter how malformed:
Live demo: malformedhtml.html — Missing tags, mismatched case, unclosed elements, non-standard tags — the browser still renders it.