我正在阅读WCAG 2.0 Technique H30 .
程序说:
For each link in the content that uses this technique:
- Check that text or a text alternative for non-text content is included in the a element
- If an img element is the only content of the a element, check that its text alternative describes the purpose of the link
- If the a element contains one or more img element(s) and the text alternative of the img element(s) is empty, check that the text of the link describes the purpose of the link
- If the a element only contains text, check that the text describes the purpose of the link
我关注的是第 2 点:如果 img
具有 alt
属性,但没有替代文本怎么办?
例如,以下代码是否满足该技术要求?
<a href="http://www.mystite.com">
<img src="http://www.mystite.com/myimage.jpg" alt="Description of the image" />
</a>
最佳答案
我想说你的例子不满足技术要求。
您的 a
元素仅包含一个 img
元素。根据 H30,该图像的 alt
属性应包含有关链接目标的信息,而不是有关图像本身的信息。
http://www.w3.org/TR/WCAG20-TECHS/H30.html#H30-description :
When an image is the only content of a link, the text alternative for the image describes the unique function of the link.
关于html - 具有 alt 属性但没有文本的 img 是否满足 WCAG 2.0 : Technique H30?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16712565/