是< img src =" [srcpath]" ALT ="">与< img src =" [srcpath]"相同< ALT>当涉及到可访问性? [英] Is <img src="[srcpath]" alt=""> the same as <img src="[srcpath]" alt> when it comes to accessibility?

查看:129
本文介绍了是< img src =" [srcpath]" ALT ="">与< img src =" [srcpath]"相同< ALT>当涉及到可访问性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< img src =[srcpath]alt =>
< img src =[srcpath]alt>

也就是说:

是那些都认为图像 alt 文本的空值?或者你必须确保存在 alt =

解决方案

使用 alt =属性。在为图片提供替代文本的规范明确使用它。这是另一个空的 alt =属性



但是,如果我要查看Chrome中的DOM检查器并查看 img 在源代码中有 alt =,我会看到< img src =[srcpath] alt>



WCAG 2.0标准中的失败标准F65 注意到存在 alt 属性。它没有说明HTML5标准是否必须将alt属性显式声明为空( alt =),并且只要根据规范使用HTML ,其中 < img src =[srcpath]alt> 在技术上将被视为可以访问。所以总之 - 是的,他们从技术上来说,在涉及到可访问性时是相同的,但我不是从给定的指令中派生出来的。通过使用 alt =,您意识到 alt 属性的作用,并保持您的一致性alt技术与HTML规范相关。


<img src="[srcpath]" alt="">
<img src="[srcpath]" alt>

That is to say:

Are those both considered null values for image alt text? Or must you ensure the alt="" is present?

解决方案

You should use the alt="" attribute. Each example of the null alt attribute in the specs for providing alternative text for an image explicitly uses it. Here's another resource on the empty alt="" attribute

However.. if I were to look at the DOM inspector in Chrome and look at an img that had alt="" in the source code, I would see <img src="[srcpath]" alt>.

The Failure Criterion F65 in the WCAG 2.0 standards note that the presence of the alt attribute is sought. It does not clarify whether or not the alt attribute must be explicitly declared as empty (alt="") for HTML5 standards, and as long as you're using the HTML according to the spec, having <img src="[srcpath]" alt> would technically be considered accessible.

So in summary - yes, they technically are the same when it comes to accessibility, but I'm not one to derive from given instruction. By using alt="", you are being aware of the purpose of the alt attribute, and keeping consistency in your alt techniques with respect to the HTML specifications.

这篇关于是&lt; img src =&quot; [srcpath]&quot; ALT =&QUOT;&QUOT;&GT;与&lt; img src =&quot; [srcpath]&quot;相同&lt; ALT&GT;当涉及到可访问性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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