水晶按鈕,水晶按鈕素材

來源:互聯網
上載者:User

水晶按鈕,水晶按鈕素材

  上一篇為大家介紹了一下關於菜單效果的製作,本篇為大家再分享一下關於水晶按鈕的實現,本篇我們將不會再涉及javascript的知識,所有效果我們都將同css來實現,內容沒有什麼難度,學完本篇我相信大家對css的強大,一定會感到讚歎的,廢話不多說,下面我們先來看一下效果:

  

  中的最上面的三個按鈕效果是通過css改變input標籤來實現的,下面兩個則是兩個a標籤,通過css來改變相應的樣式,下面我們一起來學習一下上面的效果。

 一、按鈕設定:

  在介面上添加三個input按鈕:

<input type="submit" value="提交"/>    <input type="button" value="上交"/>    <input type="reset" value="重設">

 css代碼:

input{ width: 100px; height: 40px; border: none; background-image: url(button/btn.png);}

  這樣的效果存在的問題就是,我們的背景是固定的,不能隨我們的內容增加而改變。

 二、a標籤的效果的顯示:

  a標籤:

<a href="#"><span>按鈕</span></a>

  css代碼:

     a{ text-decoration: none; padding-left: 15px; display: inline-table; width: 100px; height: 40px; line-height: 40px; background: url(button/btn_bg.png);}        a:HOVER{ background-position: 0 -80px;}        a span{ display: inline-table; height: 40px; padding-right: 15px; color: #fff; background: url(button/btn_bg.png) right -40px;}        a:HOVER span{ background-position: right -120px;}

 三、css3新增的圓角設定屬性實現上述效果:

  a標籤:

<a href="#" class="button" >按鈕</a>

  css新增圓角屬性:

     .button{ display: inline-table; height: 40px; color: #fff; padding: 0 15px; background: url(button/css3_btn_bg.png); text-align: center; border: 1px solid #3c8134; border-radius: 5px}        .button:HOVER { background-position: 0 -40px;}

 四、最後我們通過一個菜單效果的案例結束本篇的總結:

  :

  

  介面代碼:

<body>    <ul>        <li><a href="#" class="ac"><span>首頁</span></a></li>        <li><a href="#"><span>最新產品</span></a></li>        <li><a href="#"><span>內部新聞</span></a></li>        <li><a href="#"><span>聯絡我們</span></a></li>    </ul></body>

  css代碼:

<style type="text/css">body ul li {margin: 0px; padding: 0px; font-size: 12px; }ul { list-style-type: none; height: 27px; width:500px;border-bottom:2px solid #21530C}li { float: left; }a{display:inline-block;height:27px;line-height:27px;text-decoration:none;padding-left:9px;color:#000;margin-right:10px;}a span{display:inline-block;height:27px;padding-right:9px;}a:hover{    background:url(button/left.jpg) no-repeat ;}a:hover span{    background:url(button/right.jpg) no-repeat  right #21530C;color:#fff;}    </style>

  好了到這裡我們關於水晶按鈕的實現,就為大家分享完畢了,代碼這裡面關於css代碼都是最基本的,相信大家應該沒有什麼困難。如果你有什麼好的想法,請留言交流。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.