<div class="pub_switch_box">
<input type="checkbox" id="pub_switch_a1" class="pub_switch" />
<label for="pub_switch_a1"></label>
<input type="checkbox" id="pub_switch_a2" class="pub_switch" checked />
<label for="pub_switch_a2"></label>
</div>
/*滑动按钮样式 <-- start --> */
.pub_switch_box {
font-size: 0;
display: inline-block;
margin-left: 30%;
} .pub_switch {
display: none;
} .pub_switch + label {
display: inline-block;
position: relative;
width: 56px;
height: 26px;
margin: 5px;
background-color: #fafbfa;
border-radius: 50px;
-webkit-transition: all 0.1s ease-in;
transition: all 0.1s ease-in;
} .pub_switch + label:after {
content:"";
position: absolute;
top: 0;
width: 100%;
height: 100%;
-webkit-transition: box-shadow 0.1s ease-in;
transition: box-shadow 0.1s ease-in;
left: 0;
border-radius: 100px;
box-shadow: inset 0 0 0 0 #eee, 0 0 1px rgba(0, 0, 0, 0.4);
} .pub_switch + label:before {
content: "";
position: absolute;
top: 0;
left: 1px;
z-index: 999999;
width: 26px;
height: 26px;
-webkit-transition: all 0.1s ease-in;
transition: all 0.1s ease-in;
border-radius: 100px;
box-shadow: 0 3px 1px rgba(0, 0, 0, 0.05), 0 0 1px rgba(0, 0, 0, 0.3);
background: white;
} .pub_switch:active + label:after {
box-shadow: inset 0 0 0 20px #eee, 0 0 1px #eee;
}
.pub_switch:active + label:before {
width: 37px;
}
.pub_switch:checked:active + label:before {
width: 37px;
left: 20px;
}
.pub_switch + label:active {
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05),
inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
.pub_switch:checked + label:before {
content: "";
position: absolute;
left: 31px;
border-radius: 100px;
}
.pub_switch:checked + label:after {
content: "";
font-size: 1.5em;
position: absolute;
background: #3399ff;
box-shadow: 0 0 1px #3399ff;
}
/* <-- end --> */

css 滑动按钮样式的更多相关文章

  1. 利用纯CSS美化checkbox和radio和滑动按钮的实现

    W3C提供的CheckBox和radio的原始样式非常的丑,而且在不同的额浏览器表现还不一样,使用常规的方法添加样式没法进行修改样式 一, 单选按钮 <html> <head> ...

  2. 纯CSS打造好看的按钮样式

    好看的按钮.链接.div样式,效果预览: http://hovertree.com/code/run/css/s8o19792.html 发现今天积分和排名不错: 代码如下: <!DOCTYPE ...

  3. 漂亮的CSS按钮样式集以及在线生成工具

    以前我们制作一样带带阴影.圆角或3D感的按钮都需要用图片来制作,但CSS3出来后就可以不用图片了,由于是代码写的按钮样式,在Retina上浏览依然清晰美观.虽然不错,但我们写一个阴影+质感的按钮还是挺 ...

  4. [HTML/CSS]uploadify自定义按钮样式

    概述 在项目中经常用到uploadify上传插件,但是FLASH按钮的外观往往跟我们网页的设计的主题色不太搭配.这时就需要对其样式进行修改. 样式文件是uploadify.css. 打开这个文件后,你 ...

  5. 「HTML+CSS」--自定义按钮样式【002】

    前言 Hello!小伙伴! 首先非常感谢您阅读海轰的文章,倘若文中有错误的地方,欢迎您指出- 哈哈 自我介绍一下 昵称:海轰 标签:程序猿一只|C++选手|学生 简介:因C语言结识编程,随后转入计算机 ...

  6. CSS/CSS3常用样式小结

    1.强制文本单行显示: white-space:nowrap; 多行文本最后省略号: display: -webkit-box; -webkit-line-clamp:2; overflow: hid ...

  7. [总结]CSS/CSS3常用样式与web移动端资源

    CSS/CSS3常用样式与知识点 IE条件注释 条件注释简介 IE中的条件注释(Conditional comments)对IE的版本和IE非IE有优秀的区分能力,是WEB设计中常用的hack方法.条 ...

  8. [原创]Lodop打印, 以及Lodop引用css文件控制打印样式的问题.

    最近在做Lodop打印功能: 思路是:  用MasterPage搭个打印页面的框架, 然后在具体的页面中填入数据, 打印的样式由母版页和CSS来控制. 困扰了一天的问题是:  在打印的JS文件中, 引 ...

  9. 5个基于css3超炫的鼠标滑动按钮动画

    今天给大家分享5个基于css3超炫的鼠标滑动按钮动画.这5个按钮鼠标经过的时候有超炫的动画效果.这5个按钮适用浏览器:360.FireFox.Chrome.Safari.Opera.傲游.搜狗.世界之 ...

随机推荐

  1. 为什么数值类型byte取值范围是(-128~127)?

    在解决这个问题之前,我们先了解几个概念? 一.原码, 反码, 补码的概念 正数的反码和补码都与原码一样: 负数的反码.补码与原码不同,负数的反码:原码中除去符号位,其他的数值位取反,0变1,1变0.负 ...

  2. php7安装

    # 配置参数 ./configure --prefix=/usr/local/php7 \ --with-config-file-path=/usr/local/php7/etc \ --with-m ...

  3. The insertion sort algorithm expressed in pseudocode - 插入排序

    Computer Science An Overview _J. Glenn Brookshear _11th Edition procedure Sort (List) N ← 2; while ( ...

  4. OpenGL 完全教程(写给Delphi的开发者) 前言

    前言 在开发了许多2D图形程序之后,许多人开始对3D图形编程产生了兴趣.学习一套3D API,是进行3D图形编程的基础.在有趣的3D图形编程中,3D API只不过充当着一种低级的工具而已.因此,在这里 ...

  5. TM2013修改帐号数据目录

    M 2013安装以后,聊天记录文件夹默认的保存位置是在“我的文档”中“Tencent Files”,而QQ就可以在软件系统设置中进行指定,但TM2013没有这一栏设置,那么如何才能修改聊天记录文件夹保 ...

  6. PBAP 1.0协议翻译(Part1)

    添加vCard3.0 Spec的链接- http://tools.ietf.org/html/rfc2425- http://tools.ietf.org/html/rfc2426 寻找最新的Spec ...

  7. C# IO操作,写入文本到txt文件.

    /// <summary> /// 写入日志文件 /// </summary> /// <param name="input"></par ...

  8. Python的深拷贝与浅拷贝

    一.前奏:熟悉Python内存管理 在Python中,变量在第一次赋值时自动声明,在创建—也就是赋值的时候,解释器会根据语法和右侧的操作数来决定新对象的类型. 引用计数器:一个内部跟踪变量 引用计数: ...

  9. ThreadPoolExecutor 分析

    一.从用法入手 Creates a thread pool that creates new threads as needed, but will reuse previously construc ...

  10. IOS 手势事件的冲突

    关于手操作需要强调几点: UIImageView默认是不支持交互的,也就是userInteractionEnabled=NO ,因此要接收触摸事件(手势识别),必须设置userInteractionE ...