html - alt =""在某些情况下是否适用于 html img 标签?

标签 html accessibility alt-attribute

我们有一个完全与网络可访问性合规性相关的项目。发布后大约一周,无障碍委员会审查了我们的网站,并给出了最后的赞许。然而,他们向我们反馈说我们应该在我们的一些图标上设置 alt="",因为它们不会为网站提供任何额外的内容,因此只会分散屏幕阅读器的注意力而不会产生任何好处。

  1. 这是正确的吗?
  2. 我的印象是 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/

相关文章:

php - 将我表单中 mysql 选项标记的结果传递给 php 不起作用

iphone - 如何告诉 VoiceOver 控件已动画化?

javascript - div 在 PHP 中从复选框隐藏和显示

html - 如何防止对 HTML 中的某些属性进行硬编码?

html - 将 iframe 定位在亚马逊内部的特定内容上

html - 我们是否仍应使用 EM 来实现可访问性?

css - sr-only 类导致页面滚动

jquery - 如何使用 jQuery 多次更改图像的 alt 属性?

html - 如何使用 alt 属性并确保 IE 不将它们用作工具提示?

html - 我可以包装 img alt 文本吗?