标题元素没有按降序顺序排列
— 更新日期
Appears in: 无障碍功能审核
Screen readers have commands to quickly jump between headings or to specific landmark regions. In fact, a survey of screen reader users found that they most often navigate an unfamiliar page by exploring the headings.
By using correct heading and landmark elements, you can dramatically improve the navigation experience on your site for users of assistive technologies.
Lighthouse 标题级别审计如何失败 #
Lighthouse 会标记标题跳过一级或多级的页面:
例如,对页面标题使用 <h1>
元素,接着对页面的主要部分使用 <h3>
元素,将导致审计失败,因为跳过了 <h2>
级别:
<h1>Page title</h1>
<h3>Section heading 1</h3>
…
<h3>Section heading 2</h3>
…
如何修复结构不良的标题 #
- 使所有标题元素遵循反映内容结构的逻辑数字顺序。
- 确保您的标题文本清楚地传达了相关部分的内容。
例如:
<h1>Page title</h1>
<section>
<h2>Section Heading</h2>
…
<h3>Sub-section Heading</h3>
</section>
检查标题结构的一种方法是提出以下问题:“如果有人只使用标题为我的页面创建大纲,这有意义吗?”
您还可以使用微软的 Accessibility Insights 扩展等工具来可视化您的页面结构并捕获无序的标题元素。
有关更多信息,请参阅标题和陆标帖文。
资源 #
Last updated: — Improve article