.switch1 {
--line: #505162;
--dot: #d0d1d8;
--circle: #9EA0BE;
--duration: .3s;
--text: #9EA0BE;
cursor: pointer;
}
.switch1 input[name="checkbox1"] {
display: none;
}
.switch1 input[name="checkbox1"] + div.chck1 {
position: relative;
width: 54px;
transform: translate(200%, -600%);
}
.switch1 input[name="checkbox1"] + div.chck1:before, .switch1 input[name="checkbox1"] + div.chck1:after {
--s: 1;
content: "";
position: absolute;
height: 3.5px;
top: 10px;
width: 24px;
background: var(--line);
transform: scaleX(var(--s));
transition: transform var(--duration) ease;
}
.switch1 input[name="checkbox1"] + div.chck1:before {
--s: 0;
left: 0;
transform-origin: 0 50%;
border-radius: 2px 0 0 2px;
}
.switch1 input[name="checkbox1"] + div.chck1:after {
left: 28px;
transform-origin: 100% 50%;
border-radius: 0 2px 2px 0;
}
.switch1 input[name="checkbox1"] + div.chck1 span.chk1 {
line-height: 24px;
color: var(--text);
}
.switch1 input[name="checkbox1"] + div.chck1 span.chk1:before {
--x: 0;
--b: var(--circle);
--s: 3px;
content: "";
position: absolute;
left: 0;
top: 0;
width: 20px;
height: 20px;
border-radius: 50%;
box-shadow: inset 0 0 0 var(--s) var(--b);
transform: translateX(var(--x));
transition: box-shadow var(--duration) ease, transform var(--duration) ease;
}
.switch1 input[name="checkbox1"] + div.chck1 span.chk1:not(:empty) {
padding-left: 64px;
}
.switch1 input[name="checkbox1"]:checked + div.chck1:before {
--s: 1;
}
.switch1 input[name="checkbox1"]:checked + div.chck1:after {
--s: 0;
}
.switch1 input[name="checkbox1"]:checked + div.chck1 span.chk1:before {
--x: 28px;
--s: 12px;
--b: var(--dot);
}
<label class="switch1">
<input name="checkbox1" type="checkbox">
<div class="chck1">
<span class="chk1"></span>
</div>
</label>
Mam taki problem, że checkbox się nie przesuwa pionowo, a poziomo już tak