示例工程 30-semantic-landmarks
30-semantic-landmarks/demo-01-page-landmarks/index.html
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>页面地标演示</title>
<style>
body { margin: 0; padding: 24px; background: #f8fafc; color: #0f172a; font-family: system-ui, sans-serif; line-height: 1.7; }
.page { max-width: 820px; margin: 0 auto; }
header { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid #e2e8f0; }
nav ul { display: flex; gap: 12px; margin: 0; padding: 0; list-style: none; }
nav a { color: #2563eb; font-size: 14px; text-decoration: none; }
main { padding: 22px 0; }
h1 { margin: 0 0 10px; font-size: 30px; }
h2 { margin: 18px 0 8px; font-size: 19px; }
footer { padding-top: 12px; border-top: 1px solid #e2e8f0; color: #64748b; font-size: 13px; }
code { padding: 1px 5px; border-radius: 4px; background: #f1f5f9; font-family: ui-monospace, monospace; }
</style>
</head>
<body>
<div class="page">
<header>
<span>示例文档</span>
<nav aria-label="主导航">
<ul>
<li><a href="#intro">介绍</a></li>
<li><a href="#usage">用法</a></li>
</ul>
</nav>
</header>
<main>
<h1>页面地标</h1>
<section id="intro">
<h2>介绍</h2>
<p>header、nav、main、footer 构成页面的骨架。</p>
</section>
<section id="usage">
<h2>用法</h2>
<p>一个页面一个 main,多个 nav 要区分名称。</p>
</section>
</main>
<footer>
<p>© 2026 示例 · 页脚</p>
</footer>
</div>
</body>
</html>