05-xhtml-1.0.demo.html
html-spec/examples/05-xhtml-1.0.demo.html · 85 line(s) · html
<?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" lang="en">
<head>
<title>XHTML 1.0 (2000) — Use-Case Demonstration</title>
</head>
<body>
<h1>XHTML 1.0 (2000) — Use-Case Demonstration</h1>
<p><strong>Date:</strong> 2026-10-25</p>
<p>
XHTML 1.0 is HTML 4.01 reformulated as well-formed XML. The element set is the same; what
changes are the syntax rules. Each example demonstrates a rule and states whether it
<em>performs as expected in a modern browser</em>: ✓ Yes, or ✗ No.
</p>
<hr />
<h2>Use case 1 — Self-closing empty elements</h2>
<p><strong>Title:</strong> XML-style void tags  |  <strong>Date:</strong> 2026-10-25</p>
<p>A line break<br />and a horizontal rule follow:</p>
<hr />
<p>Empty elements must be closed with <code>/></code> in XHTML.</p>
<p><strong>Performs as expected:</strong> ✓ Yes</p>
<hr />
<h2>Use case 2 — Self-closed image</h2>
<p><strong>Title:</strong> Image with quoted attributes  |  <strong>Date:</strong> 2026-10-25</p>
<p><img src="https://www.w3.org/Icons/w3c_home" alt="W3C logo" width="72" height="48" /></p>
<p><strong>Performs as expected:</strong> ✓ Yes — all attribute values are quoted and the tag is self-closed.</p>
<hr />
<h2>Use case 3 — Lowercase element and attribute names</h2>
<p><strong>Title:</strong> Case sensitivity  |  <strong>Date:</strong> 2026-10-25</p>
<p>In XHTML every tag and attribute name is <strong>lowercase</strong> — <code><P></code> must be written <code><p></code>.</p>
<p><strong>Performs as expected:</strong> ✓ Yes</p>
<hr />
<h2>Use case 4 — Fully-expanded (no minimized) attributes</h2>
<p><strong>Title:</strong> Boolean attributes written in full  |  <strong>Date:</strong> 2026-10-25</p>
<form action="#" method="get">
<p>
<input type="checkbox" id="agree" name="agree" checked="checked" />
<label for="agree">I agree</label>
</p>
<p>
<select name="pick">
<option value="a" selected="selected">A</option>
<option value="b">B</option>
</select>
</p>
</form>
<p><strong>Performs as expected:</strong> ✓ Yes — <code>checked="checked"</code> and <code>selected="selected"</code> are the required expanded forms.</p>
<hr />
<h2>Use case 5 — Fragment identifier via id (not name)</h2>
<p><strong>Title:</strong> Named destination  |  <strong>Date:</strong> 2026-10-25</p>
<p id="target">This paragraph is a link target, identified with <code>id</code>.</p>
<p><a href="#target">Jump to it</a>.</p>
<p><strong>Performs as expected:</strong> ✓ Yes — XHTML uses <code>id</code>; the old <code>name</code> attribute on anchors is deprecated.</p>
<hr />
<h2>Use case 6 — Well-formed strict nesting</h2>
<p><strong>Title:</strong> Properly nested inline markup  |  <strong>Date:</strong> 2026-10-25</p>
<p>Text with <strong>bold and <em>bold-italic</em></strong> that is strictly nested and closed.</p>
<p><strong>Performs as expected:</strong> ✓ Yes</p>
<hr />
<p><strong>Summary:</strong> Every XHTML 1.0 syntax rule — self-closed void elements, quoted
attributes, lowercase names, expanded boolean attributes, <code>id</code> fragments, strict
nesting — is honoured here and renders as expected. XHTML 1.0 added no new elements over
HTML 4.01; only the authoring discipline is stricter.</p>
</body>
</html>