.checkbox{ width: 64px; height: 31px; margin: 0 auto; } .checkbox input[type=checkbox]{ margin: 0; visibility: hidden; left: 7px; top: 7px; } .checkbox label{ height: 100%; border-radius: 4px; display: block; perspective: 100px; position: relative; z-index: 1; } .checkbox label:before, .checkbox label:after{ content: 'Nope'; color: #fff; background: #ce1212; font-size: 16px; font-weight: bold; text-align: center; width: 100%; height: 100%; padding: 5px 0; border-radius: 4px; transform: rotateY(0deg); position: absolute; top: 0; left: 0; transition: all 0.4s ease; } .checkbox label:after{ content: 'Yeah'; background: #588101; transform: rotateY(-180deg); left: 0; z-index: -1; } .checkbox input[type=checkbox]:checked+label:before{ transform: rotateY(180deg); } .checkbox input[type=checkbox]:checked+label:after{ transform: rotateY(0deg); z-index: 1; } @media only screen and (max-width:767px){ .checkbox{ margin: 0 0 20px; } }