【css2、css3】css改變select選擇框的樣式

來源:互聯網
上載者:User

標籤:back   order   --   pre   分享   one   doctype   image   dex   

效果:

代碼:

 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4     <meta charset="UTF-8" /> 5     <title>Document</title> 6     <style type="text/css"> 7         /* 去掉預設樣式,設定新的樣式 */ 8         .select-style{ 9             position: relative;10             display: inline-block;11         }12         .select-style select{13             display:inline-block;14             box-sizing:border-box;15             background:none;16             border:1px solid #222;17             outline:none;18             -webkit-appearance:none;19             padding:5px 15px 5px 5px;20             line-height:inherit;21             color:inherit;22             cursor:pointer;23             font-size:14px;24             position:relative;25             z-index:3;26             height:100%;27             border-radius:2px;28         }29         .select-style:after{30             content:‘*‘;31             color:red;32             position:absolute;33             top: 0;34             bottom:0;35             right:5px;36             height:100%;37             padding:5px 0;38         }39         .select-style select option{40             color:#222;41         }42         .select-style select option:hover{43             background:#535353;44             color:#fff;45         }46         .select-style select option:checked{47             background:#535353;48             color:#fff;49         }50     </style>51 </head>52 <body>53     <!-- html 布局 -->54     <span class="select-style">55         <select>56             <option>option 1</option>57             <option>option 2</option>58             <option>option 3</option>59             <option>option 4</option>60             <option>option 5</option>61         </select>62     </span>63 </body>64 </html>

 

【css2、css3】css改變select選擇框的樣式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.