Add hover text without javascript like we hover on a user's reputation

前端 未结 4 665
小蘑菇
小蘑菇 2020-12-22 21:35

In stackoverflow, when we hover on a user\'s reputation we see a text. I have seen this at many places and the source code tells me that it can be done without js. And i tri

相关标签:
4条回答
  • 2020-12-22 22:26

    Use the title attribute, for example:

    <div title="them's hoverin' words">hover me</div>

    or:

    <span title="them's hoverin' words">hover me</span>

    0 讨论(0)
  • 2020-12-22 22:26

    The title attribute also works well with other html elements, for example a link...

    <a title="hover text" ng-href="{{getUrl()}}"> download link
    </a>
    
    0 讨论(0)
  • 2020-12-22 22:27

    You're looking for tooltip

    For the basic tooltip, you want:

    <div title="This is my tooltip">
    

    For a fancier javascript version, you can look into:

    http://www.designer-daily.com/jquery-prototype-mootool-tooltips-12632

    The above link gives you 12 options for tooltips.

    0 讨论(0)
  • 2020-12-22 22:38

    Often i reach for the abbreviation html tag in this situation.

    <abbr title="Hover">Text</abbr>

    https://www.w3schools.com/tags/tag_abbr.asp

    0 讨论(0)
提交回复
热议问题