首頁  >  文章  >  web前端  >  css怎麼為button設定陰影

css怎麼為button設定陰影

藏色散人
藏色散人原創
2021-03-22 16:41:324736瀏覽

css為button設定陰影的方法:先建立一個HTML範例檔案;然後設定一個button按鈕;最後透過在button加上「box-shadow」等屬性來實現陰影效果。

css怎麼為button設定陰影

本文操作環境:Windows7系統、HTML5&&CSS3版,DELL G3電腦

css3做一個帶有陰影的button按鈕

效果比較滑鼠劃上前與後:

css怎麼為button設定陰影

<!--html代码-->
<input class="but" type = "button" value = "确认" />
<!--css代码-->
<style type="text/css">
 .but{
 border: 0px groove orange;
 box-shadow: 5px 6px 10px #000;
 margin-left: 160px;
 border-radius: 10px;
 background: #034c92;
 color: white;
 width: 250px;
 height: 40px;
 font-size: 20px;
 }
 .but:hover{
 box-shadow: 8px 10px 10px #000;
 background: #005DF9;
 }
 </style>

【推薦學習:css影片教學

以上是css怎麼為button設定陰影的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn