SOURCE

console 命令行工具 X clear

                    
>
console
<div class="wrapper">   
    <p class="p1">3. 移动端开关 checkbox</p>
    <input type="checkbox" id="checkbox_c1" class="chk_3" /><label for="checkbox_c1"></label>  <br><br>
    <input type="checkbox" id="checkbox_c2" class="chk_3" checked /><label for="checkbox_c2"></label>
</div>
* { margin: 0;padding: 0; }

.wrapper{
    width: 200px;
    margin: 0 auto;
}
.p1 {
    margin: 100px 0 30px 0;
}

.chk_3 {
    display: none;
}
.chk_3 + label {
    background-color: #fafbfa;
    padding: 9px;
    border-radius: 50px;
    display: inline-block;
    position: relative;
    margin-right: 30px;
    -webkit-transition: .1s ease-in;
    transition: .1s ease-in;
    width: 40px;
    height: 15px;
}

.chk_3  + label:after {
    content: ' ';
    position: absolute;
    top: 0;
    -webkit-transition: box-shadow .1s ease-in;
    transition: box-shadow .1s ease-in;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 100px;
    box-shadow: inset 0 0 0 0 #eee, 0 0 1px rgba(0,0,0,0.4);
}

.chk_3  + label:before {
    content: ' ';
    position: absolute;
    background: white;
    top: 1px;
    left: 1px;
    z-index: 999999;
    width: 31px;
    -webkit-transition: .1s ease-in;
    transition: .1s ease-in;
    height: 31px;
    border-radius: 100px;
    box-shadow: 0 3px 1px rgba(0,0,0,0.05), 0 0px 1px rgba(0,0,0,0.3);
}

.chk_3:active + label:after {
    box-shadow: inset 0 0 0 20px #eee, 0 0 1px #eee;
}

.chk_3:active + label:before {
    width: 37px;
}

.chk_3:checked:active + label:before {
    width: 37px;
    left: 20px;
}

.chk_3  + label:active {
    box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px 1px 3px rgba(0,0,0,0.1);
}

.chk_3:checked + label:before {
    content: ' ';
    position: absolute;
    left: 26px;
    border-radius: 100px;
}

.chk_3:checked + label:after {
    content: ' ';
    position: absolute;
    background: #4cda60;
    box-shadow: 0 0 1px #4cda60;
}