.checkbox{ display: inline-block; } .checkbox input[type=checkbox]{ margin: 0; visibility: hidden; left: 1px; top: 1px; } .checkbox label{ background-color: #d55050; width: 50px; height: 26px; cursor: pointer; border-radius: 5px; box-shadow: inset 0px 4px 0px 0px rgba(0, 0, 0, 0.2); transition: all 0.5s ease 0s; } .checkbox label:before{ content: ""; background-color: #fafafa; width: 20px; height: 17px; border-radius: 4px; box-shadow: 0px 3px 0px 0px #d2d2d2; position: absolute; top: 3px; left: 3px; transition: all 0.25s; } .checkbox input[type=checkbox]:checked+label{ background-color: #25c686; } .checkbox input[type=checkbox]:checked+label:before{ left: 27px; } @media only screen and (max-width:767px){ .checkbox{ margin: 0 0 20px; } }