welcome to Qijie's Blog 薛其杰

在做工具的Accessiblity测试时, 对于image对象,一直分不清它的alt属性与tooltip属性的区别与用法, 从网上查了下, 比较认同这样的观点:

alt属性: alternative text, 是在浏览器不能显示图像的时候用来代替图像而显示的文字。本质上讲,用户看到的要么是图像,要么是alt文字,但是用户不能即看到图片,又看到它的替代文字。

tooltip属性:用于对图像进行补充说明的文字, 用户将鼠标移动到图像上, 鼠标附近跳出一段描述性的文字。

用法: 使用alt属性来显示图像替代文字, 如果想提供更多图像的补充说明, 就使用title属性。

 

英文原话:

Only use the alt attribute to specify alternative text. If you want to provide supplemental information that browsers may choose to display as a tooltip, use the title attribute.

posted on 2015-07-06 10:56  零点零一  阅读(574)  评论(0编辑  收藏  举报