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开关的更多相关文章

  1. 自定义switch开关

    自定义一个switch开关 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...

  2. mui的switch开关的应用

    HTML: <!--mui的switch开关--> <div class="mui-content-padded"> <h5>switch开关m ...

  3. CSS做一个Switch开关

    本文为博主原创,转载请注明出处. Switch开关: 根据需求可知,Switch开关只有两种选择,true或false.所以我们想到HTML的checkbox控件,用它来做. <input id ...

  4. 使用css3 制作switch开关

    使用css3来实现switch开关的效果: html代码: <!--switch开关--><div class="switch-btn"> <inpu ...

  5. 微信小程序组件解读和分析:十五、switch 开关选择器

    switch 开关选择器组件说明: switch,开关选择器.只能选择或者不选.这种属于表单控件或者查询条件控件. switch 开关选择器示例代码运行效果如下: 下面是WXML代码: [XML] 纯 ...

  6. elementui switch 开关,点击确认按钮后在进行开关

    <el-table-column label="上头条" align="center"> <template slot-scope=" ...

  7. 微信小程序 主题皮肤切换(switch开关)

    示例效果: 功能点分析: 1.点击switch开关,切换主题皮肤(包括标题栏.底部tabBar):2.把皮肤设置保存到全局变量,在访问其它页面时也能有效果3.把设置保存到本地,退出应用再进来时,依然加 ...

  8. mui switch(开关)里面token不能及时更新

    做登录的时候再本地用locaStorage存了一个token值,但是登录之后进入页面里面发现一个switch开关里面的token值会跟着开关的切换在上一个token和当前的这个token值之间切换,我 ...

  9. layui switch 开关监听 弹出确定状态转换

    不废话,直接上图: 原始状态:   点击确定: 点击取消或者X 代码: <!doctype html> <html lang="en"> <head& ...

  10. mui switch 开关js控制打开 & Cannot read property 'toggle' of null

    //打开开关 mui('#mySwitch').switch().toggle(); //小开关打开异常的情况解决办法$(".mui-switch-handle").attr(&q ...

随机推荐

  1. (转)SQL Server 2008无法修改表的解决办法

    转自:http://www.soaspx.com/dotnet/sql/mssql/sql2008/sqlserver2008_20121010_9683.html 在SQL Server 2008 ...

  2. (最大上升子序列) Super Jumping! Jumping! Jumping! -- hdu -- 1087

    http://acm.hdu.edu.cn/showproblem.php?pid=1087   Super Jumping! Jumping! Jumping! Time Limit:1000MS  ...

  3. 从数据库到NoSQL思路整理

    1. 数据库为什么要算范式?细说起来太多. 范式解决了数据冗余,从而保证ACID的操作性能.不然一堆删除异常,插入异常,就没法愉快的写SQL了 另外,对于多个业务公用的数据库,范式解决了集成的问题. ...

  4. 深入浅析Node.js单线程模型

    Node.js采用 事件驱动 和 异步I/O 的方式,实现了一个单线程.高并发的运行时环境,而单线程就意味着同一时间只能做一件事,那么Node.js如何利用单线程来实现高并发和异步I/O?本文将围绕这 ...

  5. 页面中的删除确认(ajax)、输入框中确认信息是否可用(ajax)的jquery代码

    1.页面中的删除确认(ajax) <%@ page language="java" contentType="text/html; charset=UTF-8&qu ...

  6. Java IO流详尽解析(转)

    流的概念和作用 学习Java IO,不得不提到的就是JavaIO流. 流是一组有顺序的,有起点和终点的字节集合,是对数据传输的总称或抽象.即数据在两设备间的传输称为流,流的本质是数据传输,根据数据传输 ...

  7. EBS FORM 编译

    http://www.cnblogs.com/quanweiru/archive/2013/01/01/2841574.html EBS R11============================ ...

  8. 【Win10】开发中的新特性及原有的变更(二)

    声明:本文内容适用于 Visual Studio 2015 RC 及 Windows 10 10069 SDK 环境下,若以后有任何变更,请以新的特性为准. 十一.x:Bind 中使用强制转换 这点是 ...

  9. Python学习-31.Python中集合的一些操作

    add方法: s = {1,2,3} s.add(4) print(s)# {1, 2, 3, 4} 同list的append方法,若调用s.add(3),则不会有任何影响.这点与C#中的HashSe ...

  10. Oracle/PLSQL: BitAnd Function

    BITAND 函数 本文介绍 Microsoft Excel 中 BITAND 函数的公式语法和用法. 说明 返回两个数的按位“与”. 语法 BITAND( number1, number2) BIT ...