您现在的位置是:网站首页> 编程资料编程资料
HTML的checkbox和radio样式美化的简单实例HTML5实现的自定义Checkbox和Radiobox 很酷的选中动画效果源码通过jQuery实现自定义可以替代html自带的checkbox和radiobox
2021-08-30
1246人已围观
简介 下面小编就为大家带来一篇HTML的checkbox和radio样式美化的简单实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
HTML的checkbox和radio样式美化的简单实例
checkbox:
XML/HTML Code复制内容到剪贴板
- <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:
XML/HTML Code复制内容到剪贴板
- <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
相关内容
- 详解HTML/XHTML中img图像标签的基本用法HTML中img标签只显示图片中心位置的方法(三种方法)HTMLimg标签的alt属性和title属性使用介绍HTML图片img标签_动力节点Java学院整理
- HTML基础知识——css样式表,样式属性,格式与布局详解网页布局中CSS样式无效的十个重要原因详解CSS样式表与格式布局详解DIV+CSS通用样式布局实例代码CSS布局中如何组织样式表以便于简化、维护详解常用css样式(布局)
- PHP-HTMLhtml重要知识点笔记(必看)HTML5中的nav标签学习笔记HTML学习笔记--HTML的语法详解(必看)HTML5学习笔记之html5与传统html区别 HTML设计模式日常学习笔记整理HTML基础笔记(推荐)
- HTML基础知识——设置超链接的样式简单实例html/css基础篇——html代码编写过程中的几个警惕点(必看)html、css基础注意点(前端必看篇)HTML CSS样式基础(必看篇)HTML基础总结推荐(段落)HTML基础知识——css样式表,样式属性,格式与布局详解HTML基础必看——全面了解css样式表HTML基础必看---表单,图片热点,网页划区和拼接详解HTML基础重点_一般标签、常用标签和表格浅谈HTML(css基础样式)前端开发每天必学之HTML入门介绍
- HTML基础必看——全面了解css样式表html/css基础篇——html代码编写过程中的几个警惕点(必看)html、css基础注意点(前端必看篇)HTML CSS样式基础(必看篇)HTML基础总结推荐(段落)HTML基础知识——css样式表,样式属性,格式与布局详解HTML基础知识——设置超链接的样式简单实例HTML基础必看---表单,图片热点,网页划区和拼接详解HTML基础重点_一般标签、常用标签和表格浅谈HTML(css基础样式)前端开发每天必学之HTML入门介绍
- 如何实现textarea中获取动态剩余字数的方法用CSS实现textArea中的placeholder换行功能使用CSS禁止textarea调整大小功能的方法textarea布局时文字在左下边且不能改变大小尺寸的解决方法HTML中的文本框textarea标签
- 关于table表格中的内容溢出布局方法关于表格table嵌套,边框合并问题的解决方法CSS display属性的table表格布局深入解析HTML的table表格标签与相关的换行问题
- html 隐藏滚动条的简单实现HTML基础重点_一般标签、常用标签和表格HTML制作个人简历的简单实现详解HTML中table表格的frame和rules属性HTML的form表单标签用法学习教程HTML中的超链接标签使用教程HTML中table表格标签的基础学习教程HTML5学习心得总结(推荐)HTML基础必看---表单,图片热点,网页划区和拼接详解
- 移动端网页大小自适应的实现方法HTML5 移动页面自适应手机屏幕四类方法总结PC端和移动端自适应问题的快速解决方法浅谈移动端的自适应布局问题(响应式、rem/em、Js动态)
- html的footer置于页面最底部的简单实现方法CSS实现footer“吸底”效果详解CSS五种方式实现Footer置底利用CSS使footer固定在页面底部的实例代码详解HTML5将footer置于页面最底部的方法(CSS+JS)
