【问题标题】:Hover Message in html on a button将 html 中的消息悬停在按钮上
【发布时间】:2012-01-25 21:22:25
【问题描述】:

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

谢谢

【问题讨论】:

  • 使用title 属性。
  • 看到我的回答了吗?它就在那里。

标签: html web hover


【解决方案1】:

使用标题属性。

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

【讨论】:

  • title 是一个属性。 input 是标签。
  • @CodyGray 如果我想在标题中显示存储在变量 $count 中的一些值怎么办。就像悬停时的“23 reg left”。其中 $ 计数 = 23
  • @rachel title="&lt;?php echo $count . "reg left" ; ?&gt;"
【解决方案2】:

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

示例:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-30
    • 2018-12-07
    • 1970-01-01
    • 2018-11-05
    • 2013-09-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多