CSS3实例分享--超炫checkbox复选框和radio单选框


Posted in HTML / CSS onSeptember 01, 2014

之前为大家分享了好多css3实现的按钮。今天要为大家分享的是纯css3实现的checkbox复选框和radio单选框,效果超级炫。先让我们看看图吧!

CSS3实例分享--超炫checkbox复选框和radio单选框

这个实例完全由css3实现的没有任何js代码。下面我们一起看下实现代码吧

html代码:

复制代码
代码如下:

<div style="width:200px; float:left">
<label>
<input type="checkbox" class="option-input checkbox" checked="">
Checkbox
</label>
<label>
<input type="checkbox" class="option-input checkbox">
Checkbox
</label>
<label>
<input type="checkbox" class="option-input checkbox">
Checkbox
</label>
</div>
<div style="width:200px; float:left">
<label>
<input type="radio" class="option-input radio" name="example">
Radio option
</label>
<label>
<input type="radio" class="option-input radio" name="example">
Radio option
</label>
<label>
<input type="radio" class="option-input radio" name="example">
Radio option
</label>
</div>

css3代码:

复制代码
代码如下:

@-webkit-keyframes click-wave {
0% {
width: 40px;
height: 40px;
opacity: 0.35;
position: relative;
}
100% {
width: 200px;
height: 200px;
margin-left: -80px;
margin-top: -80px;
opacity: 0.0;
}
}
@-moz-keyframes click-wave {
0% {
width: 40px;
height: 40px;
opacity: 0.35;
position: relative;
}
100% {
width: 200px;
height: 200px;
margin-left: -80px;
margin-top: -80px;
opacity: 0.0;
}
}
@-o-keyframes click-wave {
0% {
width: 40px;
height: 40px;
opacity: 0.35;
position: relative;
}
100% {
width: 200px;
height: 200px;
margin-left: -80px;
margin-top: -80px;
opacity: 0.0;
}
}
@keyframes click-wave {
0% {
width: 40px;
height: 40px;
opacity: 0.35;
position: relative;
}
100% {
width: 200px;
height: 200px;
margin-left: -80px;
margin-top: -80px;
opacity: 0.0;
}
}
.option-input {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
position: relative;
top: 13.33333px;
width: 40px;
height: 40px;
-webkit-transition: all 0.15s ease-out 0;
-moz-transition: all 0.15s ease-out 0;
transition: all 0.15s ease-out 0;
background: #cbd1d8;
border: none;
color: #fff;
cursor: pointer;
display: inline-block;
outline: none;
position: relative;
margin-right: 0.5rem;
z-index: 1000;
}
.option-input:hover {
background: #9faab7;
}
.option-input:checked {
background: #40e0d0;
}
.option-input:checked::before {
width: 40px;
height: 40px;
position: absolute;
content: '\2716';
display: inline-block;
font-size: 26.66667px;
text-align: center;
line-height: 40px;
}
.option-input:checked::after {
-webkit-animation: click-wave 0.65s;
-moz-animation: click-wave 0.65s;
animation: click-wave 0.65s;
background: #40e0d0;
content: '';
display: block;
position: relative;
z-index: 100;
}
.option-input.radio {
border-radius: 50%;
}
.option-input.radio::after {
border-radius: 50%;
}</p> <p>body {
display: -webkit-box;
display: -moz-box;
display: box;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
box-orient: horizontal;
-webkit-box-pack: start;
-moz-box-pack: start;
box-pack: start;
-webkit-box-align: stretch;
-moz-box-align: stretch;
box-align: stretch;
background: #e8ebee;
color: #9faab7;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center;
}
body div {
padding: 5rem;
}
body label {
display: block;
line-height: 40px;
}

是不是很简单。只要复制上面的html代码和css代码到页面上。运行就可以看到效果了。赶紧试一试吧。哈哈

HTML / CSS 相关文章推荐
CSS3 Flexbox中flex-shrink属性的用法示例介绍
Dec 30 HTML / CSS
CSS3制作气泡对话框的实例教程
May 10 HTML / CSS
CSS3模拟动画下拉菜单效果
Apr 12 HTML / CSS
CSS3自定义滚动条样式的示例代码
Aug 21 HTML / CSS
详解如何在css中引入自定义字体(font-face)
May 17 HTML / CSS
Html5中的桌面通知Notification的实现
Sep 25 HTML / CSS
html5 canvas 使用示例
Oct 22 HTML / CSS
html5适合移动应用开发的12大特性
Mar 19 HTML / CSS
移动端解决悬浮层(悬浮header、footer)会遮挡住内容的3种方法
Mar 27 HTML / CSS
五个2015 年最佳HTML5 框架
Nov 11 HTML / CSS
HTML中的表单Form实现居中效果
May 25 HTML / CSS
HTML实现仿Windows桌面主题特效的实现
Jun 28 HTML / CSS
CSS实现限制字数功能当对象内文本溢出时显示省略标记
Aug 20 #HTML / CSS
CSS3的transition和animation的用法实例介绍
Aug 20 #HTML / CSS
使用CSS3的背景渐变Text Gradient 创建文字颜色渐变
Aug 19 #HTML / CSS
css3中新增的样式使用示例附效果图
Aug 19 #HTML / CSS
css3 position fixed固定居中问题解决方案
Aug 19 #HTML / CSS
CSS3实现多背景展示效果通过CSS3定位多张背景
Aug 10 #HTML / CSS
CSS3实现圆角、阴影、透明效果并兼容各大浏览器
Aug 08 #HTML / CSS
You might like
isset和empty的区别
2007/01/15 PHP
php发送get、post请求的6种方法简明总结
2014/07/08 PHP
深入剖析PHP中printf()函数格式化使用
2016/05/23 PHP
PHP中利用sleep函数实现定时执行功能实现代码
2016/08/25 PHP
PHP 实现公历日期与农历日期的互转换
2017/09/13 PHP
tp5(thinkPHP5)框架连接数据库的方法示例
2018/12/24 PHP
DIY jquery plugin - tabs标签切换实现代码
2010/12/11 Javascript
通过Jquery.cookie.js实现展示浏览网页的历史记录超管用
2015/10/23 Javascript
jQuery版本升级踩坑大全
2016/01/12 Javascript
jQuery Mobile和HTML5开发App推广注册页
2016/11/07 Javascript
详解vue-resource promise兼容性问题
2017/06/20 Javascript
JS数组去重的6种方法完整实例
2018/12/08 Javascript
Angular实现svg和png图片下载实现
2019/05/05 Javascript
JS实现给数组对象排序的方法分析
2019/06/24 Javascript
一篇超完整的Vue新手入门指导教程
2020/11/18 Vue.js
[37:03]完美世界DOTA2联赛PWL S3 INK ICE vs GXR 第二场 12.16
2020/12/18 DOTA
[01:03:41]DOTA2-DPC中国联赛 正赛 Dynasty vs XG BO3 第三场 2月2日
2021/03/11 DOTA
在python中的socket模块使用代理实例
2014/05/29 Python
python3实现TCP协议的简单服务器和客户端案例(分享)
2017/06/14 Python
详解python基础之while循环及if判断
2017/08/24 Python
flask入门之文件上传与邮件发送示例
2018/07/18 Python
python用opencv批量截取图像指定区域的方法
2019/01/24 Python
浅析python表达式4+0.5值的数据类型
2020/02/26 Python
pycharm 关闭search everywhere的解决操作
2021/01/15 Python
纯css实现照片墙3D效果的示例代码
2017/11/13 HTML / CSS
世界上最全面的汽车零部件和配件集合:JC Whitney
2016/09/04 全球购物
印度购物网站:TATA CLiQ
2017/11/23 全球购物
Calzedonia美国官网:意大利风格袜子、打底裤和沙滩装
2018/07/19 全球购物
古汉语文学求职信范文
2014/03/16 职场文书
担保书格式
2015/01/20 职场文书
2015年父亲节寄语
2015/03/23 职场文书
保护校园环境倡议书
2015/04/28 职场文书
入党积极分子党支部意见
2015/06/02 职场文书
html5表单的required属性使用
2021/07/07 HTML / CSS
SQLServer中exists和except用法介绍
2021/12/04 SQL Server
JavaScript实现优先级队列
2021/12/06 Javascript