
switch.png

switch2.png
<input class="bs_switch" id="bs_switch" name="bs_switch" type="checkbox" data-on="启用" data-off="开启" value="1">
.bs_switch {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
text-align: center;
position: relative;
width: 60px;
height: 22px;
border: 1px solid #DFDFDF;
outline: 0;
border-radius: 16px;
box-sizing: border-box;
background: #CCCCCC;
cursor: pointer;
}
.bs_switch:active, .bs_switch:visited {
outline: none
}
.bs_switch:before {
content: attr(data-off);
position: absolute;
top: 0;
left: 0;
padding-left: 24px;
border-radius: 15px;
background-color: #CCCCCC;
color: #fff;
}
.bs_switch:after {
content: " ";
position: absolute;
top: 0px;
left: 0;
width: 20px;
height: 20px;
border-radius: 15px;
background-color: #FFFFFF;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
transition: transform .3s;
}
.bs_switch:checked {
border-color: #009BDB;
background-color: #009BDB;
}
.bs_switch:checked:after {
transform: translateX(38px);
}
.bs_switch:checked:before {
content: attr(data-on);
padding-left: 0px;
/* height: 30px; */
background-color: #009BDB;
color: #fff;
width: 31px;
}
网友评论