数据标题/数据原始标题属性和可访问性 [英] Data-title/data-original-title attributes and accessibility

查看:107
本文介绍了数据标题/数据原始标题属性和可访问性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搜索有关属性data-title和data-original-title的信息。我的问题是,Twitter Bootstrap将标题属性转换为数据原始标题,但我不确定这就是我想要的。例如屏幕阅读器呢?他们会将数据标题视为标题,还是忽略它?如果我使用这些数据属性之一,是否还必须添加标题属性?

I have been searching for information about the attributes data-title and data-original-title. My issue is that Twitter Bootstrap converts the title-attribute into a data-original-title and I am not sure that this is what I want. What about screen readers for instance? Do they treat the data-title as a title, or do they ignore it? If I use one of those data-attributes, do I have to add a title-attribute as well?

推荐答案

href = http://www.w3.org/TR/2014/CR-html5-20140731/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes rel = nofollow>为HTML5定义了自定义 data-* 属性。他们打算将自定义数据存储在页面或应用程序私有。

The custom data-* attributes are defined for HTML5. They are "intended to store custom data private to the page or application".

规范说:


这些属性不适用于独立于使用该属性的网站的软件。

These attributes are not intended for use by software that is independent of the site that uses the attributes.

因此,其他工具(例如屏幕阅读器)不应使用它们。

So other tools (like screen readers) should not make use of them.

如果某些内容是标题,不应首先使用 data-* 属性(如 data-title ),因为规范中说 […]没有更合适的属性或元素;使用标题

If something is a title, you should not use a data-* attribute (like data-title) in the first place, as the spec says "[…] for which there are no more appropriate attributes or elements"; use title.

这篇关于数据标题/数据原始标题属性和可访问性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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