用CSS實現的一張圖完成的按鈕執行個體

來源:互聯網
上載者:User
本篇文章主要介紹如何用CSS實現的一張圖完成的按鈕執行個體,很好用很奧妙,值得收藏和分享 通過css來讀取圖片座標系實現局部背景圖,感興趣的小夥伴參考一下。

網易126登入按鈕代碼如下:

<style> .inp_L1,.inp_L2,{background:url(/upload/20080515201218970.jpg) no-repeat} .inp_L1{ width:67px; height:23px; background-position:-4px -4px; border:0; color:#464646; line-height:23px} .inp_L2{ width:67px; height:23px; background-position:-4px -30px; border:0; color:#464646; line-height:23px} </style> <input type="submit" value="登 錄" class="inp_L1" onMouseOver="this.className='inp_L2'" onMouseOut="this.className='inp_L1'" id="input_btn1"  name="enter.x" tabindex="4">

導覽按鈕代碼如下:

<head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>用CSS實現的一張圖完成的導航條</title> <style> ul,li{ list-style:none; float:left;} body{ font-size:12px; line-height:1.6; font-family:Verdana, "宋體", Arial; text-align:center;} #info li{ margin-left:4px; margin-top:15px;} #info a {display:block;text-align:center; padding-left:15px; padding-top:2px;padding-bottom:1px;background-image:  url(/upload/20080515201218783.GIF); background-repeat: no-repeat;color: #000; width:47px; cursor:hand; text-decoration: none;} #job a:link,#job a:visited{background-position: -62px 0px;} #eve a:link,#eve a:visited{background-position: -124px 0px;} #oth a:link,#oth a:visited{background-position: -186px 0px;} #car a:hover ,#car a:active {background-position: 0px -22px; color:#fff;} #job a:hover ,#car a:active {background-position: -62px -22px; color:#fff;} #eve a:hover ,#car a:active {background-position: -124px -22px; color:#fff;} #oth a:hover ,#car a:active {background-position: -186px -22px; color:#fff;} </style> </head> <body>  <div id="info">  <ul>   <li id="car"><a href="#" target="_blank"><span>  遊 戲</span></a></li>   <li id="job"><a href="#" target="_blank"><span>  娛 樂</span></a></li>   <li id="eve"><a href="#" target="_blank"><span>  菜 單</span></a></li>   <li id="oth"><a href="#" target="_blank"><span>  好 玩</span></a></li>     </ul>  </div> </body> </html>


相關推薦:

CSS實現3D按鈕效果

AngularJS開發WebApp實現高亮跳轉按鈕效果,ui-sref和ui-sref-active的使用方法

css3實現3D按鈕效果的文章推薦

CSS3展現橫向滾動功能表按鈕效果代碼

相關文章

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.