html, body {
margin: 0;
padding: 0;
}
:root {
--toggle-switch-bg: #232428;
--toggle-border: #232428;
--toggle-bg: #fff;
}
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.toggle-wrap label {
display: inline-block;
position: relative;
width: 110px;
height: 50px;
border: 0.2em solid var(--toggle-border);
border-radius: 50rem;
}
.toggle-input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.toggle-switch {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: var(--toggle-bg);
transition: .4s;
border-radius: 50rem;
}
.toggle-switch::before {
position: absolute;
content: "";
height: 42px;
width: 42px;
left: 4px;
bottom: 4px;
background-color: var(--toggle-switch-bg);
transition: .4s;
border-radius: 50%;
}
.toggle-input:checked + .toggle-switch::before {
transform: translateX(60px);
}