gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 00:29:51 26 4
gpt4 key购买 nike

我正在网页上实现 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com