DIV+CSS 網頁TIP的簡單作法_CSS/HTML

來源:互聯網
上載者:User
基本的原理就是用display;當display: block;就顯示;當display:none;時就不顯示;
例如:
複製代碼 代碼如下:
#infobox span{ display: none; }
#infobox a:hover span{display: block;position:absolute;}

<!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=utf-8" /> <title>zishu test tip</title> <style> /* zishu.cn */ *{ margin:0; padding:0; list-style:none; font-size:12px; line-height:1.8;} body{ background: #333} #info{padding:50px;} #infobox{padding:0px 20px;background-color: #640000;} #center{background: #ABBAAC; border-top:2px solid #333; padding:20px;} .c{ clear:both; height:1px; overflow: hidden; background:#333} #infobox li{ border-right:1px solid #000; float:left; margin-right:1px; text-align:center;margin-top:-4px; } a{ width:100px;line-height:28px; display:block;} a:link,a:visited{color:#000;background:#FF9900;text-decoration: none;} a:hover,a:active{ color:#FFFF00;background:#000;} /*以是下顯示TIP的內容*/ #infobox span{ display: none; } #infobox a:hover span{display: block;position:absolute;border:1px solid #640000;background: #FFFFCC;margin-top:26px!important; margin-top:20px;color:#000;padding:5px;white-space: nowrap;} </style> </head> <body> <ul> <li><span>從這裡可以進入我的首頁!</span>網站首頁</li> <li><span>這裡邊有一些英語和笑話!</span>英語笑話</li> <li><span>這裡都是一些朋友的網站!</span>友情連結</li> <li><span>你要有什麼要說的就來這!</span>給我留言</li> <li><span>是自已寫的和收集的文章!</span>技術文章</li> <li><span>沒有了都放在日記裡面了!</span>生活照片</li> </ul> </body> </html>
[Ctrl+A 全選 注:如需引入外部Js需重新整理才能執行]
  • 相關文章

    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.