tooltips for Button

2019-01-10 23:50发布

问题:

Is it possible to create a tooltip for an html button. Its the normal HTML button and there is no Title attribute as it is there for some html controls. Any thoughts or comments?

回答1:

Simply add a title to your button.

<button title="Hello World!">Sample Button</button>



回答2:

both <button> tag and <input type="button"> accept a title attribute..



回答3:

title is a standard attribute and can be used almost everywhere

See this http://www.w3schools.com/tags/tag_button.asp



回答4:

For everyone here seeking a crazy solution, just simply try

title="your-tooltip-here"

in any tag. I've tested into td's and a's and it pretty works.



回答5:

You should use both title and alt attributes to make it work in all browsers.

<button title="Hello World!" alt="Hello World!">Sample Button</button>