.demo{ background-color: #333; } .checkbox{ width: 20px; height: 20px; margin: 0 auto; border-radius: 20px; overflow: hidden; position: relative; } .checkbox input[type=checkbox]{ margin: 0; visibility: hidden; left: 7px; top: 7px; } .checkbox label{ background: #bebebe; width: 100%; height: 100%; transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1); } .checkbox label:after{ content: ""; width: 60%; height: 35%; border-left: 3px solid #fff; border-bottom: 3px solid #fff; margin: auto; transform: rotate(-45deg); position: absolute; left: 0; right: 0; top: 20px; transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1); } .checkbox input[type=checkbox]:checked+label{ background: linear-gradient(#FF512F, #DD2476); } .checkbox input[type=checkbox]:checked+label:after{ top: 6px; } @media only screen and (max-width:767px){ .checkbox{ margin: 0 0 20px; } }