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>