Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I depend on the title attribute showing up as a tooltip?

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.)

like image 413
froadie Avatar asked Sep 19 '11 07:09

froadie


People also ask

How do I stop the title attribute from displaying tooltip?

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....

What is the function of the title attribute when using ToolTips?

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).

Do screen readers read the title attribute?

Access to title attribute information is not supported uniformly by screen readers.

How do I change the tooltip title in CSS?

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.


2 Answers

It is a standard, you should be pretty safe.

See http://www.w3.org/TR/html4/struct/global.html#h-7.4.3

like image 77
Babak Naffas Avatar answered Oct 11 '22 12:10

Babak Naffas


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.

like image 27
Harry Joy Avatar answered Oct 11 '22 10:10

Harry Joy