123.toggle-switch {4 position: relative;5 display: inline-block;6 width: 60px;7 height: 34px;8}9.toggle-input {10 display: none;11}12.toggle-label {13 position: absolute;14 top: 0;15 left: 0;16 width: 60px;17 height: 34px;18 border-radius: 17px;19 background-color: #ccc;20 cursor: pointer;21 transition: background-color 0.4s ease;22}23.toggle-label:before {24 content: '';25 position: absolute;26 top: 3px;27 left: 3px;28 width: 28px;29 height: 28px;30 border-radius: 50%;31 background-color: #fff;32 box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);33 transition: transform 0.4s ease;34}35.toggle-input:checked + .toggle-label {36 background-color: #86d993;37}38.toggle-input:checked + .toggle-label:before {39 transform: translateX(26px);40}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
.toggle-switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.toggle-input {
display: none;
}
.toggle-label {
position: absolute;
top: 0;
left: 0;
width: 60px;
height: 34px;
border-radius: 17px;
background-color: #ccc;
cursor: pointer;
transition: background-color 0.4s ease;
}
.toggle-label:before {
content: '';
position: absolute;
top: 3px;
left: 3px;
width: 28px;
height: 28px;
border-radius: 50%;
background-color: #fff;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
transition: transform 0.4s ease;
}
.toggle-input:checked + .toggle-label {
background-color: #86d993;
}
.toggle-input:checked + .toggle-label:before {
transform: translateX(26px);
}
You need to sign in before you can write a comment.