css-toggle-switch with js
by FirstBug
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/css-toggle-switch@latest/dist/toggle-switch.css">
<input class="toggle" type="checkbox" />
<label class="switch-light switch-material" onclick="">
<input type="checkbox">
<strong>
Wireless
</strong>
<span>
<span>Off</span>
<span>On</span>
<a></a>
</span>
</label>
CSS
.toggle {
-webkit-appearance: none;
appearance: none;
width: 31px;
height: 16px;
display: inline-block;
position: relative;
border-radius: 50px;
overflow: hidden;
outline: none;
border: none;
cursor: pointer;
background-color: #707070;
transition: background-color ease 0.3s;
}
.toggle:before {
content: "on off";
display: block;
position: absolute;
z-index: 2;
width: 14px;
height: 14px;
background: #fff;
left: 2px;
top: 2px;
border-radius: 50%;
font: 10px/28px Helvetica;
text-transform: uppercase;
font-weight: bold;
text-indent: -11px;
word-spacing: 37px;
color: #fff;
text-shadow: -1px -1px rgba(0, 0, 0, 0.15);
white-space: nowrap;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
transition: all cubic-bezier(0.3, 1.5, 0.7, 1) 0.3s;
}