微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – aria-label和title属性有什么区别?

参见英文答案 > What is aria-label and how should I use it?3
我习惯于在我的链接/按钮/ …上使用title =“”属性来详细说明.但是,由于可理解的原因,引导程序使用了很多aria-label =“”属性,据我所知.

所以我想起来创建如下的按钮:

<button
    id="show-raw-result"
    class="btn btn-default btn-sm btn-twigfiddle"
    title="Result was not easily readable so it has been automatically cleaned up,use this button to see the result raw"
    aria-label="Result was not easily readable so it has been automatically cleaned up,use this button to see the result raw">
    <span class="glyphicon glyphicon-asterisk"></span> Show raw result
</button>

但是,复制/粘贴标题来创建一个咏叹调标签看起来很丑陋.我应该选择哪一个,为什么?

解决方法

ARIA标签用于您网站的残疾游客. Bootstrap非常好,认情况下它们支持它.

Accessible Rich Internet Applications (ARIA) defines ways to make Web
content and Web applications (especially those developed with Ajax and
JavaScript) more accessible to people with disabilities. For example,
ARIA enables accessible navigation landmarks,JavaScript widgets,form
hints and error messages,live content updates,and more.

资料来源:https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA

要回答你的问题,你应该使用哪一个,只使用标题属性.因为如果您的鼠标移动按钮并将标题文本显示为工具提示,则使用此属性.以这种方式不支持aria标签.

原文地址:https://www.jb51.cc/html/230683.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐