// *, *:after, *:before { // // box-sizing: border-box; // } // body { // min-height: 100vh; // display: flex; // align-items: center; // justify-content: center; // } .switch { position: relative; input[type="checkbox"] { visibility: hidden; position : absolute; &:checked + label { transform: rotate(0deg); background-color: #000; &:before { transform: translateX(35.5px); background-color: #fff; } } } label { display: flex; width: 70px; height: 34px; border: 3px solid; border-radius: 99em; position: relative; transition: transform 0.3s ease-in-out; transform-origin: 50% 50%; cursor: pointer; &:before { transition: transform 0.3s ease; transition-delay: 0s; content: ""; display: block; position: absolute; width: 24px; height: 24px; background-color: #000; border-radius: 50%; top: 2px; left: 3px; } } }