CSS實現alt_title效果

來源:互聯網
上載者:User
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">   <head>     <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> <title>頁面標題</title> <style> /*設定連結的屬性,一定要設定為relative才能使提示層跟著連結走*/ .info { position:relative; background:#fff; color:#666;  text-decoration:none; font-size:12px; width:150px; padding:5px; text-align:center; border:1px solid#ccc; height:25px; line-height:25px; } .info:hover {background:#eee;color:#333;} .info span {display: none }/*設定正常下的span為隱藏狀態*/
 /*設定hover下的span屬性為呈現狀態,並設定提示層的位置*/ .info:hover span{ display:block; position:absolute; top:35px; left:50px; width:130px; border:1px solid #ff0000;  background:#fff;  color:#000; padding:5px; text-align:left; } </style>   </head> <body>    <a class="info" href="http://www.baidu.com">百度<span>顯示百度了嗎?</span></a>    <a class="info" href="http://www.360doc.com">360doc<span>歡迎進入360圖書館,錯了,好像不是360的</span></a> </body> </html>
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.