HTML的checkbox和radio样式美化的简单实例
HTML的checkbox和radio样式美化的简单实例
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样式美化的简单实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持我们。
原文地址:http://www.cnblogs.com/shouce/archive/2016/06/08/5569173.html
栏 目:CSS/HTML
下一篇:html标签的嵌套规则介绍
本文标题:HTML的checkbox和radio样式美化的简单实例
本文地址:https://www.xiuzhanwang.com/a1/CSS_HTML/9687.html
您可能感兴趣的文章
- 04-02好看的字体样式css,好看的字体样式图片
- 04-02分页样式css,分页样式栏里用来定义首页的属性
- 04-02css样式的引入,css样式怎么引入
- 04-02css样式引入方式有几种,网页引入css样式有几种方式
- 04-02css滚动条样式,css滚动条的样式
- 04-02html中加入css样式的简单介绍
- 04-02内嵌样式css,内嵌样式表,内部样式表,外部样式表中优先级最高的
- 04-02vue中的css样式布局,vue添加css样式
- 01-10通过html为FLASH加链接的实现代码(div层)
- 01-10IE浏览器HTML Hack标签总结
阅读排行
本栏相关
- 04-02表格样式css样式,css样式表单
- 04-02好看的字体样式css,好看的字体样式图
- 04-02分页样式css,分页样式jq
- 04-02分页样式css,分页样式栏里用来定义首
- 04-02css样式的引入,css样式怎么引入
- 04-02css滚动条样式,css滚动条的样式
- 04-02css样式引入方式有几种,网页引入css样
- 04-02html中加入css样式的简单介绍
- 04-02vue中的css样式布局,vue添加css样式
- 04-02内嵌样式css,内嵌样式表,内部样式表
随机阅读
- 08-05dedecms织梦模板编辑文档的同时自动更
- 01-11常用的HTML富文本编译器UEditor、CKEdi
- 01-10bat批处理彻底隐藏文件的方法(使用
- 08-05织梦dedecms首页调用缩略图为背景
- 01-10C++实现将数组中的值反转
- 01-10C++ 类访问控制的条件总结
- 01-10C语言打印杨辉三角示例汇总
- 01-10vue实现分页加载效果
- 08-05dedecms织梦模板全站调用收藏数的方法
- 08-05DEDECMS点击主栏目默认显示第一个子栏