<style>
input[type="checkbox"] {
display: none;
}
input[type="checkbox"] + label {
display: inline-block;
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;
20px;
height: 20px;
-webkit-transition: 0.3s;
transition: 0.3s;
cursor: pointer;
}
#btn:checked + label {
background: #AEDCAE;
}
#btn:checked + label:after {
background: #5CB85C;
}
#btn:checked + label:after {
left: calc(100% - 18px);
}
#btn + label {
background: #ddd;
border-radius: 20px;
}
#btn + label:after {
background: #fff;
border-radius: 50%;
16px;
height: 16px;
top: 2px;
left: 2px;
}
</style>
<input type="checkbox" id="btn">
<label for="btn"></label>