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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The custom data-*
attributes are defined for HTML5. They are "intended to store custom data private to the page or application".
The spec says:
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.
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
.