CSS執行個體(七):工具條效果

來源:互聯網
上載者:User

圖片素材:

  網頁代碼:Html代碼  

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
  2. <html xmlns="http://www.w3.org/1999/xhtml">   
  3. <head>   
  4.     <meta http-equiv="Content-Type" content="text/html; charset=GB2312"/>   
  5. <title></title>  
  6. <style type="text/css">  
  7.     html,body{  
  8.         font-size:12px;  
  9.     }  
  10.     .dataBar a,.dataBar span,.dataBar div{  
  11.         display:block;  
  12.         height:16px;  
  13.         line-height:16px;  
  14.         vertical-align:middle;  
  15.         float:left;  
  16.     }  
  17.     .dataBar div{  
  18.         float:left;  
  19.         padding:0 0.5em;  
  20.     }  
  21.     .dataBar a{  
  22.         color:red;  
  23.         text-decoration:none;  
  24.         padding-left:3px;  
  25.     }  
  26.     .dataBar a:hover,.dataBar a#currentData{  
  27.         color:white;  
  28.     }  
  29.     .dataBar  span{  
  30.         cursor:hand;  
  31.         padding-right:3px;  
  32.     }  
  33.     .dataBar a:hover,.dataBar a:hover span,.dataBar a#currentData,.dataBar a#currentData span{  
  34.         background:url(tab.gif) 0 0;  
  35.     }  
  36.     .dataBar a:hover span,.dataBar a#currentData span{  
  37.         background-position:100% 100%;  
  38.     }  
  39. </style>  
  40. <script type="text/javascript">  
  41.         function itemClick(a){  
  42.             var id = "currentData";  
  43.             if(a.id==id){  
  44.                 return true ;  
  45.             }  
  46.             else{  
  47.                 document.getElementById(id).id="";  
  48.                 a.id=id;  
  49.             }  
  50.             return true;  
  51.         }  
  52. </script>  
  53. </head>  
  54. <body style="background-color:#ccc">  
  55.     <!--http://wallimn.iteye.com-->  
  56.     <div class="dataBar" style="height:16px;">  
  57.         <a href="#" id="currentData" onclick="itemClick(this)"><span>最新動向</span></a>  
  58.         <div>|</div>  
  59.         <a href="#" onclick="itemClick(this)"><span>高清</span></a>  
  60.         <div>|</div>  
  61.         <a href="#" onclick="itemClick(this)"><span>美劇</span></a>  
  62.         <div>|</div>  
  63.         <a href="#" onclick="itemClick(this)"><span>動漫</span></a>  
  64.     </div>  
  65. </body>  
  66. </html>  

  效果,編輯調試環境IE7:

相關文章

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.