HTML的checkbox和radio樣式美化的簡單實(shí)例
HTML的checkbox和radio樣式美化的簡單實(shí)例
checkbox:
- <style type="text/css">
- input[type="checkbox"]
- {
- display: none;
- }
- input[type="checkbox"] + label
- {
- display: inline-block;
- position: relative;
- border: solid 2px #99a1a7;
- width: 35px;
- height: 35px;
- line-height: 35px;
- border-radius: 4px;
- }
- input[type="checkbox"]:checked + label:after
- {
- content: '\2714';
- font-size: 25px;
- color: #99a1a7;
- width: 35px;
- height: 35px;
- line-height: 35px;
- position: absolute;
- text-align: center;
- background-color: #e9ecee;
- }
- .tab
- {
- margin-top: 20px;
- margin-bottom: 20px;
- width: 100%;
- }
- .tab td
- {
- border: solid 1px #f99;
- font-size: 25px;
- line-height: 39px;
- }
- </style>
- <table class="tab" cellpadding="0" cellspacing="0" style="border-collapse: collapse;">
- <tr>
- <td>
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="ck101" type="checkbox" />
- <label for="ck101"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試101
- </div>
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="ck102" type="checkbox" />
- <label for="ck102"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試102
- </div>
- 測試
- </td>
- <td></td>
- </tr>
- <tr>
- <td style="text-align: center;">
- <div style="display: inline-block;">
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="ck103" type="checkbox" />
- <label for="ck103"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試103
- </div>
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="ck104" type="checkbox" />
- <label for="ck104"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試104
- </div>
- 測試
- </div>
- </td>
- <td>測試
- </td>
- </tr>
- </table>
- <div style="border: solid 1px #f99; height: 39px; margin-top: 20px; margin-bottom: 20px;">
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="ck201" type="checkbox" />
- <label for="ck201"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試201
- </div>
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="ck202" type="checkbox" />
- <label for="ck202"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px;">
- 測試202
- </div>
- </div>
radio:
- <style type="text/css">
- input[type="radio"]
- {
- display: none;
- }
- input[type="radio"] + label
- {
- display: inline-block;
- position: relative;
- border: solid 2px #99a1a7;
- width: 25px;
- height: 25px;
- line-height: 25px;
- padding: 5px;
- border-radius: 19.5px;
- }
- input[type="radio"]:checked + label:after
- {
- content: ' ';
- font-size: 25px;
- color: #99a1a7;
- width: 25px;
- height: 25px;
- line-height: 25px;
- position: absolute;
- text-align: center;
- background-color: #99a1a7;
- border-radius: 12.5px;
- }
- input[type="radio"]:checked + label
- {
- background-color: #e9ecee;
- }
- .tab
- {
- margin-top: 20px;
- margin-bottom: 20px;
- width: 100%;
- }
- .tab td
- {
- border: solid 1px #f99;
- font-size: 25px;
- line-height: 39px;
- }
- </style>
- <table class="tab" cellpadding="0" cellspacing="0" style="border-collapse: collapse;">
- <tr>
- <td>
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="rd101" name="rd" type="radio" />
- <label for="rd101"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試101
- </div>
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="rd102" name="rd" type="radio" />
- <label for="rd102"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試102
- </div>
- 測試
- </td>
- <td></td>
- </tr>
- <tr>
- <td style="text-align: center;">
- <div style="display: inline-block;">
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="rd103" name="rd" type="radio" />
- <label for="rd103"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試103
- </div>
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="rd104" name="rd" type="radio" />
- <label for="rd104"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試104
- </div>
- 測試
- </div>
- </td>
- <td>測試
- </td>
- </tr>
- </table>
- <div style="border: solid 1px #f99; height: 39px; margin-top: 20px; margin-bottom: 20px;">
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="rd201" name="rd" type="radio" />
- <label for="rd201"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px; margin-right: 20px;">
- 測試201
- </div>
- <div align="center" style="float: left; height: 39px; width: 39px;">
- <input id="rd202" name="rd" type="radio" />
- <label for="rd202"></label>
- </div>
- <div style="float: left; height: 39px; line-height: 39px; font-size: 25px; margin-left: 10px;">
- 測試202
- </div>
- </div>
效果圖:
以上這篇HTML的checkbox和radio樣式美化的簡單實(shí)例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持我們。
原文地址:http://www.cnblogs.com/shouce/archive/2016/06/08/5569173.html
欄 目:CSS/HTML
本文標(biāo)題:HTML的checkbox和radio樣式美化的簡單實(shí)例
本文地址:http://mengdiqiu.com.cn/a1/CSS_HTML/9687.html
您可能感興趣的文章
- 04-02好看的字體樣式css,好看的字體樣式圖片
- 04-02分頁樣式css,分頁樣式欄里用來定義首頁的屬性
- 04-02css樣式的引入,css樣式怎么引入
- 04-02css樣式引入方式有幾種,網(wǎng)頁引入css樣式有幾種方式
- 04-02css滾動條樣式,css滾動條的樣式
- 04-02html中加入css樣式的簡單介紹
- 04-02內(nèi)嵌樣式css,內(nèi)嵌樣式表,內(nèi)部樣式表,外部樣式表中優(yōu)先級最高的
- 04-02vue中的css樣式布局,vue添加css樣式
- 01-10通過html為FLASH加鏈接的實(shí)現(xiàn)代碼(div層)
- 01-10IE瀏覽器HTML Hack標(biāo)簽總結(jié)


閱讀排行
本欄相關(guān)
- 04-02表格樣式css樣式,css樣式表單
- 04-02好看的字體樣式css,好看的字體樣式圖
- 04-02分頁樣式css,分頁樣式j(luò)q
- 04-02分頁樣式css,分頁樣式欄里用來定義首
- 04-02css樣式的引入,css樣式怎么引入
- 04-02css滾動條樣式,css滾動條的樣式
- 04-02css樣式引入方式有幾種,網(wǎng)頁引入css樣
- 04-02html中加入css樣式的簡單介紹
- 04-02vue中的css樣式布局,vue添加css樣式
- 04-02內(nèi)嵌樣式css,內(nèi)嵌樣式表,內(nèi)部樣式表
隨機(jī)閱讀
- 08-05dedecms織夢模板編輯文檔的同時自動更
- 01-11常用的HTML富文本編譯器UEditor、CKEdi
- 01-10bat批處理徹底隱藏文件的方法(使用
- 08-05織夢dedecms首頁調(diào)用縮略圖為背景
- 01-10C++實(shí)現(xiàn)將數(shù)組中的值反轉(zhuǎn)
- 01-10C++ 類訪問控制的條件總結(jié)
- 01-10C語言打印楊輝三角示例匯總
- 01-10vue實(shí)現(xiàn)分頁加載效果
- 08-05dedecms織夢模板全站調(diào)用收藏數(shù)的方法
- 08-05DEDECMS點(diǎn)擊主欄目默認(rèn)顯示第一個子欄