switch开关
1.开关按钮 效果如下图

2.css代码
.form-switch{
display: inline-block;
}
.form-switch input[type="checkbox"]{ display: none; }
.form-switch >div{
position: relative;
display: inline-block;
padding: 0 5px;
width: auto!important;
min-width: 35px;
height: 22px;
line-height: 22px;
background-color: #fff;
box-shadow: #ccc 0px 0px 0px 2px;
border-radius: 20px;
overflow: hidden;
}
.form-switch div>span{
color: #999;
}
.form-switch i{
position: absolute;
left: 5px;
top: 3px;
width: 16px;
height: 16px;
border-radius: 50%;
background-color: #d2d2d2;
-webkit-transition: .1s linear;
transition: .1s linear;
}
.form-switch div >em{
position: relative;
top:;
width: 25px;
margin-left: 21px;
padding: 0!important;
text-align: center!important;
color: #999!important;
font-style: normal!important;
font-size: 12px;
}
.form-switch div >em:last-child{
display: block;
}
.form-switch input[type="checkbox"]:checked + div {
border-color: #3679b7;
background-color: #3679b7;
color: #fff;
}
.form-switch input[type="checkbox"]:checked + div i{
left: 100%;
margin-left: -21px;
background-color: #fff;
}
.form-switch input[type="checkbox"]:checked + div em:last-child{
display: block;
color: #fff;
margin-left: 5px;
margin-right: 21px;
color: #fff!important;
}
.form-switch input[type="checkbox"]:checked + div em:nth-child(2){
display: none;
color: #fff;
}
3.html结构
<label class="form-switch">
<input type="checkbox" id="toggle-button" name="switch" checked="">
<div>
<i></i>
<em>OFF</em>
<em>ON</em>
</div>
</label>
switch开关的更多相关文章
- 自定义switch开关
自定义一个switch开关 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...
- mui的switch开关的应用
HTML: <!--mui的switch开关--> <div class="mui-content-padded"> <h5>switch开关m ...
- CSS做一个Switch开关
本文为博主原创,转载请注明出处. Switch开关: 根据需求可知,Switch开关只有两种选择,true或false.所以我们想到HTML的checkbox控件,用它来做. <input id ...
- 使用css3 制作switch开关
使用css3来实现switch开关的效果: html代码: <!--switch开关--><div class="switch-btn"> <inpu ...
- 微信小程序组件解读和分析:十五、switch 开关选择器
switch 开关选择器组件说明: switch,开关选择器.只能选择或者不选.这种属于表单控件或者查询条件控件. switch 开关选择器示例代码运行效果如下: 下面是WXML代码: [XML] 纯 ...
- elementui switch 开关,点击确认按钮后在进行开关
<el-table-column label="上头条" align="center"> <template slot-scope=" ...
- 微信小程序 主题皮肤切换(switch开关)
示例效果: 功能点分析: 1.点击switch开关,切换主题皮肤(包括标题栏.底部tabBar):2.把皮肤设置保存到全局变量,在访问其它页面时也能有效果3.把设置保存到本地,退出应用再进来时,依然加 ...
- mui switch(开关)里面token不能及时更新
做登录的时候再本地用locaStorage存了一个token值,但是登录之后进入页面里面发现一个switch开关里面的token值会跟着开关的切换在上一个token和当前的这个token值之间切换,我 ...
- layui switch 开关监听 弹出确定状态转换
不废话,直接上图: 原始状态: 点击确定: 点击取消或者X 代码: <!doctype html> <html lang="en"> <head& ...
- mui switch 开关js控制打开 & Cannot read property 'toggle' of null
//打开开关 mui('#mySwitch').switch().toggle(); //小开关打开异常的情况解决办法$(".mui-switch-handle").attr(&q ...
随机推荐
- Shell编程-07-Shell中的case语句
目录 基本语法 case示例 case语句总结 case语句相当于多分支的if/elif/else语句,而在使用case会让脚本看起来更简单工整.在case语句中,程序会将获取到的值与case ...
- Java Socket重要参数讲解
(转自http://www.cnblogs.com/ggjucheng/archive/2012/01/06/2314679.html) ( http://docs.oracle.com/javase ...
- shell 文本处理——使用awk格式化时间戳
date -d @时间戳 "+%Y-%m-%d %H:%M:%S" 也可以内置函数 awk '{print strftime("%Y-%m-%d %H:%M:%S&quo ...
- oracle中row_number() over()分析函数用法
row_number()over(partition by col1 order by col2)表示根据col1分组,在分组内部根据col2排序,而此函数计算的值就表示每组内部排序后的顺序编号(组内 ...
- Android-Xml文件生成,Xml数据格式写入
在上一篇博客,Android-XML格式描述,介绍来XML在Android中的格式: 生成xml文件格式数据,Android提供了Xml.newSerializer();,可以理解为Xml序列化: 序 ...
- grunt管理js/css
1.安装node 2.npm安装 3.运行grunt,可能遇到下面的问题 可以运行npm install -g grunt 然后再运行grunt 可以看到已经压缩成功了:
- 对php和java里面的static函数和static的一些理解
static function: "static方法就是没有this的方法.在static方法里面不可以调用非静态方法,反过来是可以的.并且可以在没有创建任何对象的前提下,仅仅通过类名来调用 ...
- 爬虫Scrapy指令学习
1.新建一个新的爬虫项目指令 scrapy startproject xxx 2.在项目/spider目录下创建一个名为XXX的爬虫,并指定爬取域的范围 scrapy genspider XXX & ...
- 关于ubuntu下看视频中文字幕乱码的问题
试了几个播放器都不行.....然后把字幕文件打开后重新保存成utf-8的.... 可以了!!!! 天呐改编码真是一个万能的办法~ 随手记
- NGINX部署