<body>
<header>
<nav><ul><li><a href="/">首頁</a></li>...</ul></nav>
</header>
<main>
<article>
<header><h1>文章標題</h1><time datetime="2024-01-15">1 月 15 日</time></header>
<section><h2>章節一</h2><p>內容...</p></section>
<section><h2>章節二</h2><p>內容...</p></section>
<footer><address>作者:張三</address></footer>
</article>
<aside>
<section><h3>相關推薦</h3><ul>...</ul></section>
</aside>
</main>
<footer>© 2024 My Site</footer>
</body>
<form novalidate>
<div>
<label for="email">電子郵箱</label>
<input type="email" id="email" name="email" required placeholder="you@example.com" autocomplete="email">
</div>
<div>
<label for="age">年齡 (18-99)</label>
<input type="number" id="age" name="age" min="18" max="99" step="1" required>
</div>
<div>
<label for="color">主題色</label>
<input type="color" id="color" name="color" value="#2563eb">
</div>
<div>
<label for="avatar">頭像</label>
<input type="file" id="avatar" name="avatar" accept="image/*">
</div>
<button type="submit">註冊</button>
</form>
<script>
document.querySelector('form').addEventListener('submit', e => {
if (!e.target.checkValidity()) { e.preventDefault(); e.target.reportValidity(); }
});
</script>
<!-- 視頻:多格式回退、字幕、預載、響應式 -->
<video controls preload="metadata" poster="/img/poster.jpg" width="640" height="360">
<source src="/media/video.av1.mp4" type="video/mp4; codecs=av01.0.05M.08">
<source src="/media/video.hevc.mp4" type="video/mp4; codecs=hev1.1.6.L93.90">
<source src="/media/video.webm" type="video/webm; codecs=vp9">
<source src="/media/video.mp4" type="video/mp4">
<track kind="subtitles" src="/media/video.vtt" srclang="zh" label="中文" default>
您的瀏覽器不支援 HTML5 視頻。
</video>
<!-- 音頻 -->
<audio controls preload="none">
<source src="/media/audio.opus" type="audio/ogg; codecs=opus">
<source src="/media/audio.mp3" type="audio/mpeg">
</audio>
<canvas id="chart" width="600" height="300">不支援 Canvas</canvas>
<script>
const ctx = document.getElementById('chart').getContext('2d');
ctx.fillStyle = '#2563eb';
ctx.fillRect(50, 50, 200, 100);
ctx.beginPath();
ctx.arc(400, 150, 60, 0, Math.PI * 2);
ctx.fillStyle = '#22c55e';
ctx.fill();
</script>
HTML5 不只是「新增幾個標籤」,而是 Web 平台能力的質變。系統學習並實戰應用,才能發揮現代 Web 的全部潛力。