css
body {
min-height: 100vh;
display: grid;
place-items: center;
box-sizing: border-box;
background-color: #fff;
}
label {
position: relative;
user-select: none;
}
label input {
-webkit-appearance: none;
appearance: none;
position: relative;
cursor: pointer;
}
label input::before {
content: "";
width: 30px;
height: 30px;
position: absolute;
border: 2px solid #333;
}
i {
position: relative;
display: inline-block;
}
label i::before {
content: "";
position: absolute;
width: 0;
height: 2px;
background-color: #333;
top: 14px;
transform: rotate(45deg);
transition: all 0.1s;
transform-origin: left;
}
label i::after {
content: "";
position: absolute;
width: 0;
height: 2px;
background-color: #333;
top: 21px;
left: 6px;
transform: rotate(-45deg);
transition: all 0.1s;
transform-origin: left;
transition-delay: 0.1s;
}
label input:checked + i:before {
width: 10px;
}
label input:checked + i:after {
width: 20px;
}