Is it good practice to have an A tag that just exists for its tooltip?
Is it good practice to have a link that just exists for its tooltip开发者_StackOverflow? Like this:
<a title="10% off all widgets in September!">$90.00</a>
If you need the tooltip, then span
should be a better choice, since it carries no semantic information. An anchor would usually indicate a link, so if clicking on that price won't lead anywhere, then an anchor isn't appropriate.
Almost all HTML elements can carry the title
attribute for accessibility reasons, but you shouldn't depend on it for carrying important information since it is dependent on the user agent (ie. browser) on how best to display this information.
精彩评论