两种美化效果如下图:

代码(html)

 <div id="main">
<h2 class="top_title">使用CSS3美化复选框checkbox</h2>
<div class="demo">
<div class="wrap">
<p>1. 勾选</p>
<input type="checkbox" id="checkbox_a1" class="chk_1" checked />
<label for="checkbox_a1"></label>
<input type="checkbox" id="checkbox_a2" class="chk_1" />
<label for="checkbox_a2"></label>
</div>
<div class="wrap">
<p>2. 移动端开关</p>
<input type="checkbox" id="checkbox_b1" class="chk_2" checked />
<label for="checkbox_b1"></label>
</div>
</div>
</div>

代码(css)

 .demo{width:560px;margin:30px auto 10px auto}
.wrap{margin:30px 0}
.wrap p{padding:10px 0}
.chk_1,.chk_2{display:none;}
.top_title{text-align:center;} /*css3选择器:E+F 毗邻元素选择器,匹配所有紧随E元素之后的同级元素F*/ /*******STYLE 1*******/
.chk_1 + label {
background-color:#FFF;
border:1px solid #C1CACA;
box-shadow:0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05);
padding:9px;
border-radius:5px;
display:inline-block;
position:relative;
margin-right:30px;
}
.chk_1 + label:active {
box-shadow:0 1px 2px rgba(0,0,0,0.05), inset 0px 1px 3px rgba(0,0,0,0.1);
}
.chk_1:checked + label {
background-color:#ECF2F7;
border:1px solid #92A1AC;
color:#243441;
}
.chk_1:checked + label:after {
content:'\2714';
position:absolute;top:-8px;left:0px;
color:#758794;
width:100%;
text-align:center;
font-size:20px;
padding:1px 0 0 0;
vertical-align:text-top;
} /*******STYLE 2*******/
.chk_2 + label {
width:40px;height:15px;background:#ddd;
padding:9px;
border-radius:20px;
display:inline-block;
position:relative;
}
.chk_2 + label:before {
content:' ';
width:31px;height:31px;background:#fff;
position:absolute;top:1px;left:1px;
z-index:;
border-radius:100px;
box-shadow:0 3px 1px rgba(0,0,0,0.05), 0 0px 1px rgba(0,0,0,0.3);
transition:all 0.1s ease-in;
-webkit-transition:all 0.1s ease-in;
}
.chk_2 + label:after {
content:' ';
position:absolute;top:;left:;
width:100%;height:100%;
border-radius:50px;
box-shadow:inset 0 0 0 0 #eee, 0 0 1px rgba(0,0,0,0.4);
transition:all 0.1s ease-in;
-webkit-transition:all 0.1s ease-in;
}
.chk_2:checked + label:before {
left:26px;
}
.chk_2:checked + label:after {
background:#4cda60;
box-shadow:0 0 1px #4cda60;
}

css3美化复选框checkbox的更多相关文章

  1. 使用CSS3美化复选框checkbox

    我们知道HTML默认的复选框样式十分简陋,而以图片代替复选框的美化方式会给页面表单的处理带来麻烦,那么本文将结合实例带您一起了解一下使用CSS3将复选框checkbox进行样式美化,并且带上超酷的滑动 ...

  2. 基于CSS3自定义美化复选框Checkbox组合

    今天我们要来分享一组非常漂亮的CSS3自定义复选框checkbox,每一个checkbox都有其各自的特点.有几款checkbox在选中的情况下还会出现动画效果,非常不错的CSS3自定义美化check ...

  3. 使用css3美化复选框

    声明:文章为转载(略改动),点击查看原文.如有侵权24小时内删除,联系QQ:1522025433. 我们知道HTML默认的复选框样式十分简陋,而以图片代替复选框的美化方式会给页面表单的处理带来麻烦,那 ...

  4. 8个非常个性化的CSS3单/复选框

    单选框和复选框在网页表单中应用十分广泛,但是浏览器默认自带的单选框和复选框样式不仅不统一,而且大多都比较简单丑陋.本文给大家介绍了一些基于CSS3的个性化单选框和复选框,一些选中动画是基于jQuery ...

  5. [原创]纯JS实现网页中多选复选框checkbox和单选radio的美化效果

    图片素材: 最终效果图: <html><title> 纯JS实现网页中多选复选框checkbox和单选radio的美化效果</title><head>& ...

  6. 纯CSS3来自定义单选框radio与复选框checkbox

    单选框(radio)自定义样式 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 3 ...

  7. CSS 美化复选框 - 无图片方式

    今天和大家分享一个不使用图片美化复选框的方式.来看下效果图吧,如下是3种不同状态下的效果: 一. Html结构 <div class="check-wrap"> < ...

  8. 复选框(checkbox)、单选框(radiobox)的使用

    复选框(checkbox).单选框(radiobox)的使用 复选框: HTML: // 复选框 <input type="checkbox" name="chec ...

  9. php 判断复选框checkbox是否被选中

    php 判断复选框checkbox是否被选中   复选框checkbox在php表单提交中经常被使用到,本文章通过实例向大家介绍php如何判断复选框checkbox中的值是否被选中,需要的朋友可以参考 ...

随机推荐

  1. MVC FormCollection collection

    1.通过name获取值 collection.GetValues() 返回一个数组,适用于多选等,如果是单值可以[0] 2.直接转化为实体 将Action动作中传递的FormCollection转变成 ...

  2. 学习C++.Primer.Plus 11 使用类

    1.操作符重载 重载操作符的几个限制: a)         重载的至少有一个操作数是用户定义的类型,这将防止用户为标准类型重载操作符. b)         不能违反操作符原有来的句法规则. c)  ...

  3. jquery更改输入框type为密码框password

    很蛋疼的一个问题: <input type="text" id="e1" value="123" /> 用juqery将文本框变 ...

  4. Golang gzip的压缩和解压

    package src import ( "bytes" "compress/gzip" ) func GzipEncode(in []byte) ([]byt ...

  5. Sqlite创建增删改查

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  6. Ubuntu 14.04.1 建立 Android M, Android N 開發環境 與 問題

    # Modify /etc/apt/sources.list# add below 3 lines to /etc/apt/sources.listdeb http://archive.ubuntu. ...

  7. 使用VelocityTracker来完成MotionEvent移动速率计算

    先看效果图 关键代码(此处记录单点): switch (event.getAction()){ case MotionEvent.ACTION_DOWN: if (veloctiy==null) { ...

  8. Android LitePal 神一般的数据库框架 超级好用

    参考: Android数据库高手秘籍(一)--SQLite命令 Android数据库高手秘籍(二)--创建表和LitePal的基本用法 Android数据库高手秘籍(三)--使用LitePal升级表 ...

  9. 最为简易的yii 教程(一)

    了解目录的框架结构 framework主要有 base          框架核心组件 caching        缓存组件 db                数据库组件 gii          ...

  10. PostgreSQL Apt Repository

    PostgreSQL Apt Repository If the version included in your version of Ubuntu is not the one you want, ...