多个 h1 会导致屏幕阅读器问题吗? [英] Do multiple h1's cause screen readers problems?

查看:28
本文介绍了多个 h1 会导致屏幕阅读器问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我放置一个通过 W3C 检查器构建的网站时,它要求我考虑仅使用 h1 作为顶级标题,并指出我在一个部分中有一个 h1 的部分.它还提到屏幕阅读器会将它们全部视为顶级元素,但是,根据 HTML5 规范,部分有效地重置"了标题,因此您可以在其中从 1-6 开始另一个层次结构.

When I put a website I am building through a W3C checker it asks me to consider only using h1's as a top level heading and points out a section where I have a h1 inside of a section. It also mentions that screen readers will treat them all as top level elements, however, according to HTML5 specs, sections effectively "reset" the headings so you can start another hierarchy from 1-6 within them.

如果我们试图专注于 W3C 验证和可访问性,我是否应该只在部分中使用 h2-h6?还是这个警告不正确?

Should I only be using h2-h6 within sections if we are trying to focus on W3C validation and accessibility? Or is this warning incorrect?

推荐答案

在任何地方使用 h1 是有效的(如果正确使用了分节元素),但 HTML5 规范鼓励作者使用排名对应的标题元素到节的嵌套 (h1-h6).

Using h1 everywhere is valid (if sectioning elements are used correctly), but the HTML5 spec encourages authors to use heading elements of the rank corresponding to the section’s nesting (h1-h6).

为什么鼓励在任何地方使用h1,尽管这可以有益?很可能是因为并非所有相关的用户代理(如屏幕阅读器)都支持 HTML5 大纲算法.

Why encouraging not to use h1 everywhere, although this can be beneficial? Most likely because not all relevant user agents (like screen readers) support the HTML5 outline algorithm.

因此,如果您想支持不支持 HTML5 和/或大纲算法的屏幕阅读器,您可能需要按照建议使用适当等级的标题元素.

So if you want to support screen readers that don’t support HTML5 and/or the outline algorithm, you may want to follow the advice to use heading elements of the appropriate rank.

这篇关于多个 h1 会导致屏幕阅读器问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆