将 html 中的消息悬停在按钮上

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8600419/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 12:07:16  来源:igfitidea点击:

Hover Message in html on a button

htmlwebhover

提问by rachel

How to get hover message when mouse goes on a button.

当鼠标移到按钮上时如何获得悬停消息。

Thanks

谢谢

回答by Derk Arts

Use a title attribute.

使用标题属性。

<input type='button'  value='Press me' title='This is my title' />

回答by Deepak N

The attribute title matters here. Just add the title attribute and write the message to be given in button tag.

属性标题在这里很重要。只需添加标题属性并在按钮标签中写入要给出的消息。

example :

例子 :

<button title="Message needs to be shown">My button</button>

This should work fine. if you are using link for the button:

这应该可以正常工作。如果您使用按钮的链接:

<button><a href="http://link.php" title="Msg to be shown">My button</a></button>