How semantic HTML 教程 wins over div soup
标题大纲——h1 到 h6——给页面一个浏览器、屏幕阅读器、搜索引擎都自动理解的结构。零 ARIA。
为什么标题重要
Keyboard users press H in most screen readers to jump through headings. 搜索引擎 weight the words in h1 and h2 more heavily. The outline tree is also what Google uses when it generates sitelinks in search results.
屏幕阅读器
视力用户靠滚动扫页面,屏幕阅读器用户靠导航标题大纲。如果全是 h2 或 h3,他们得到一个扁平列表,完全没法分辨层级归属。
搜索引擎
Google 和 Bing 把标题当成强排名信号。把最重要关键词放进 h1 和 h2,不要跳级。
三条简单规则
- 每页一个 h1 — it's the page's main title.
- 不要跳级 — h1 → h3 without h2 is an error.
- 大纲匹配内容 — don't use headings just for size.
规则 1:一个 h1
Multiple h1s used to be valid under HTML 教程5, but modern best practice is one h1 per page. It's the headline — the thing that tells a reader what this page is about.
No skipped levels
h1 直接到 h3 跳过 h2——向辅助技术暗示缺东西。浏览器大纲算法把这视为错误。
Content over style
Pick the heading level that matches meaning, not how big you want the text. Use CSS 教程 to resize — don't downgrade a heading to a paragraph just to change its font size.
检查工具
Chrome 扩展
Heading Map and WebAIM WAVE both give you a one-click view of the outline tree for any page.
本页
本页左侧的大纲由一个小脚本实时生成——遍历所有 h1–h6、建树、渲染成缩进列表。点击任意标题,看大纲高亮跟着走。
小结
标题大纲是你能加到任何页面上的最重要无障碍改进——零 ARIA、零外部工具、浏览器原生支持。
⚠️ 错误——同一页上第二个 h1
故意放在这里作为反面示例。真实页面应该只有一个 h1。