我们有一个完全与网络可访问性合规性相关的项目。发布后大约一周,无障碍委员会审查了我们的网站,并给出了最后的赞许。然而,他们向我们反馈说我们应该在我们的一些图标上设置 alt="",因为它们不会为网站提供任何额外的内容,因此只会分散屏幕阅读器的注意力而不会产生任何好处。
- 这是正确的吗?
- 我的印象是 alt 是 img 的必需属性?确定 img 标签上的 alt=""会包含 alt 属性,但这有效吗?
欢迎提出意见。
最佳答案
如果图标提供任何功能(用户可点击或其他),我建议设置一个描述性的 alt
值。如果它们只是装饰性的,那么 alt=""
是有效的。
来自 the standard :
While alternate text may be very helpful, it must be handled with care. Authors should observe the following guidelines:
- Do not specify irrelevant alternate text when including images intended to format a page, for instance, alt="red ball" would be inappropriate for an image that adds a red ball for decorating a heading or paragraph. In such cases, the alternate text should be the empty string (""). Authors are in any case advised to avoid using images to format pages; style sheets should be used instead.
- Do not specify meaningless alternate text (e.g., "dummy text"). Not only will this frustrate users, it will slow down user agents that must convert text to speech or braille output.
关于html - alt =""在某些情况下是否适用于 html img 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3806326/