SOURCE

console 命令行工具 X clear

                    
>
console
<div class="row">
    <input type="checkbox" id="simple_1">
    <label for="simple_1"></label>
    
    <input type="checkbox" id="simple_2">
    <label for="simple_2" class="red"></label>
    
    <input type="checkbox" id="simple_3">
    <label for="simple_3" class="green"></label>
</div>
.row {
    width: 100%;
    display: block;
    line-height: 60px;
    text-align: center;
}
input[type="checkbox"] {
    display: none;
}
input[type="checkbox"] + label {
    display: inline-block;
    width: 40px;
    height: 20px;
    position: relative;
    -webkit-transition: 0.3s;
    transition: 0.3s;
    margin: 0px 20px;
    box-sizing: border-box;
}
input[type="checkbox"] + label:after {
    content: '';
    display: block;
    position: absolute;
    left: 0px;
    top: 0px;
    width: 20px;
    height: 20px;
    -webkit-transition: 0.3s;
    transition: 0.3s;
    cursor: pointer;
}
#simple_1:checked + label.red,
#simple_2:checked + label.red,
#simple_3:checked + label.red {
    background: #ECA9A7;
}
#simple_1:checked + label.red:after,
#simple_2:checked + label.red:after,
#simple_3:checked + label.red:after {
    background: #D9534F;
}
#simple_1:checked + label.green,
#simple_2:checked + label.green,
#simple_3:checked + label.green {
    background: #AEDCAE;
}
#simple_1:checked + label.green:after,
#simple_2:checked + label.green:after,
#simple_3:checked + label.green:after {
    background: #5CB85C;
}
#simple_1:checked + label:after,
#simple_2:checked + label:after,
#simple_3:checked + label:after {
    left: calc(100% - 20px);
}
#simple_1 + label,
#simple_2 + label,
#simple_3 + label {
    background: #ddd;
    border-radius: 20px;
}
#simple_1 + label:after,
#simple_2 + label:after,
#simple_3 + label:after {
    background: #fff;
    border-radius: 50%;
}