html - 对于没有相关替代文字的图像,是否有符合规范的做法?

标签 html attributes w3c-validation alt wcag

我正在网页上实现 Jssor 的 Bootstrap Carousel Slider。使用 W3C 的验证工具,由于缺少此特定图像的替代文本,我收到错误消息:

<div data-u="loading" class="jssorl-009-spin" style="position:absolute;top:0px;left:0px;width:100%;height:100%;text-align:center;background-color:rgba(0,0,0,0.7);">
    <img style="margin-top:-19px;position:relative;top:50%;width:38px;height:38px;" src="/svg/loading/static-svg/spin.svg" />
</div>

图像只是一个旋转的圆盘,用于表示 Jssor slider 加载。我很好奇我是否应该在此图像上使用替代文本。到目前为止,我的研究指向只包括一个空白的 alt="" 属性;对于是否应包含此内容并留空,或者如果我没有任何替代文字,是否应避免此内容,是否有权威引用?

最佳答案

根据 W3C 的 Web 可访问性倡议 (WAI) 建议,应使用空的 alt="" 属性,以便屏幕阅读器可以忽略它。

Decorative images don’t add information to the content of a page. For example, the information provided by the image might already be given using adjacent text, or the image might be included to make the website more visually attractive.

In these cases, a null (empty) alt text should be provided (alt="") so that they can be ignored by assistive technologies, such as screen readers. Text values for these types of images would add audible clutter to screen reader output or could distract users if the topic is different from that in adjacent text. Leaving out the alt attribute is also not an option because when it is not provided, some screen readers will announce the file name of the image instead.

来源:https://www.w3.org/WAI/tutorials/images/decorative/

关于html - 对于没有相关替代文字的图像,是否有符合规范的做法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52334174/

相关文章:

templates - Magento:基于属性集的模板

javascript - 如何向指令添加 bool 属性?

database - 从数据库中的 jasig cas 服务器检索属性

javascript - Chatango 嵌入代码的 W3C 验证器错误

html - 为什么我的页面在 W3C 验证器中显示为已验证,但在使用 SEO 检查工具时却没有?

html - HTML 和 CSS 中的梯形表

html - html href元素中title和name的区别

Facebook登录按钮的CSS验证问题

c# - 为什么此按钮在 ASP.NET MVC CSS 中显示在表格上方而不是下方

javascript - css遍历元素的方法