We've been coding simple tooltips into our web site for a while, and just realized that we could accomplish the same thing by simply using the "title" attribute. Any reason that we shouldn't use the title attribute as a tooltip? Are there any browsers that don't support this feature? (w3schools seems to indicate that all major browsers support this.)
There's no way to disable the default browser behaviour, which is to show the title attribute as a "tooltip" in the browser itself. You'll need to resort to some javascript, it could even be as simple as setting the title to blank on hover, and replacing it on mouse out....
The title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element. The title attribute can be used on any HTML element (it will validate on any HTML element. However, it is not necessarily useful).
Access to title attribute information is not supported uniformly by screen readers.
The tooltip is automatically generated by web browsers, it actually can not be removed or changed. To change the tooltip style, we need to add a tooltip text to a different attribute, for example data-title , then use CSS code to create and customise the style. In WordPress, you can add the CSS code to your theme CSS.
It is a standard, you should be pretty safe.
See http://www.w3.org/TR/html4/struct/global.html#h-7.4.3
All major browsers supports title
. But then you don't have ability to show this kind of custom tooltips: http://www.dreamcss.com/2009/03/list-of-25-javascriptajax-css-tooltip.html
Have you seen Users hover card on SO (this site)? If they have used title then it might be not possible to show such a wonderful tooltip.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With