How to make text appear when hover over a href

后端 未结 4 2392
耶瑟儿~
耶瑟儿~ 2021-02-19 08:07

How would I make text appear under a link?


                      
相关标签:
4条回答
  • 2021-02-19 08:22

    that's simple just add title attribute in tag

    <a href="http://www.studyofcs.com" title="Tricks Site">Studyofcs</a>
    
    0 讨论(0)
  • 2021-02-19 08:29

    In case you are using bootstrap you can use the following:

    <a class="login" href="" data-toogle="tooltip" title="Access your profile here">Login</a>

    0 讨论(0)
  • 2021-02-19 08:39

    The following style makes the p visible on hover:

    .login a p {display:none;}
    .login a:hover p {display:block;}
    <div class="login">
        <a href="">Login
            <p>Access your profile here</p>
        </a>
    </div> 

    Or if you want the whole link including p inside stay visible together on hover use the following:

    .login a p {display:none;}
    .login a:hover p {display:block;}
    .login a:hover {display:block;}
    <div class="login">
        <a href="">Login
            <p>Access your profile here</p>
        </a>
    </div> 

    0 讨论(0)
  • 2021-02-19 08:47

    Simple Html Tooltip

    <a href="https://stackoverflow.com/" title="Where Developers Learn, Share, &amp; Build Careers">stackoverflow</a>
    

    Tooltip Using Bootstrap :

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
    </head>
    <body>
    
    <div class="container">
      <h3>Tooltip Example</h3>
      <p>The data-placement attribute specifies the tooltip position.</p>
      <ul class="list-inline">
        <li><a href="#" data-toggle="tooltip" data-placement="top" title="Hooray!">Top</a></li>
        <li><a href="#" data-toggle="tooltip" data-placement="bottom" title="Hooray!">Bottom</a></li>
        <li><a href="#" data-toggle="tooltip" data-placement="left" title="Hooray!">Left</a></li>
        <li><a href="#" data-toggle="tooltip" data-placement="right" title="Hooray!">Right</a></li>
      </ul>
    </div>
    
    <script>
    $(document).ready(function(){
      $('[data-toggle="tooltip"]').tooltip();   
    });
    </script>
    
    </body>
    </html>

    You can achieve hover tooltip By Bootstrap+JQuery also :

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
    </head>
    <body>
    
    <div class="container">
      <h3>Tooltip Example</h3>
      <a href="#" data-toggle="tooltip" title="Hooray!">Hover over me</a>
    </div>
    
    <script>
    $(document).ready(function(){
      $('[data-toggle="tooltip"]').tooltip();   
    });
    </script>
    
    </body>
    </html>

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