首页 > 解决方案 > role="presentation" 或 aria-hidden="true" 用于装饰图像?

问题描述

哪个语义更好,, alt="", role="presentation"CSS bg 图像或aria-hidden="true"隐藏辅助技术的装饰图像?

标签: htmlimageaccessibility

解决方案


最好的办法是使用空白alt文本。

<img src="squiggle.gif" width="20" height="20" alt="" />

对于 AT(辅助技术)应忽略的图像,在 img 元素上使用空 alt 文本和无标题属性。

- 资源


推荐阅读