.checkbox{ display: inline-block; } .checkbox input[type=checkbox]{ margin: 0; visibility: hidden; left: 1px; top: 1px; } .checkbox label{ width: 52px; height: 30px; border: 3px solid #555; border-radius: 100px; cursor: pointer; display: block; overflow: hidden; position: relative; transition: all 0.75s ease; } .checkbox label:before, .checkbox label:after{ content: ''; background: #555; border-radius: 50px; width: 20px; height: 20px; position: absolute; top: 2px; left: 2px; opacity: 1; transition: 0.75s ease; } .checkbox label:after{ left: auto; right: 2px; opacity: 0; } .checkbox input[type=checkbox]:checked+label{ border-color: #a30d9e; box-shadow: 0 0 5px rgba(163,13,158,0.4); } .checkbox input[type=checkbox]:checked+label:before{ opacity: 0; } .checkbox input[type=checkbox]:checked+label:after{ background-color: #a30d9e; opacity: 1; } @media only screen and (max-width:767px){ .checkbox{ margin: 0 0 20px; } }