-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay23_ToggleSwitch.css
66 lines (60 loc) · 1.25 KB
/
Day23_ToggleSwitch.css
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!-- <!doctype html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="toggle-wrap">
<label for="toggle">
<input type="checkbox" id="toggle" class="toggle-checkbox"></input>
<div class="toggle-switch"></div>
</label>
</div>
</body>
</html>
-->
html, body {
height: 100%;
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
background: #C6C9DC;
}
:root {
--toggle-switch-bg: #232428;
--toggle-border: #232428;
--toggle-bg: #fff;
}
.toggle-wrap {
position: relative;
border: solid var(--toggle-border);
border-radius: 60px;
height: 70px;
width: 180px;
background: var(--toggle-bg);
}
.toggle-checkbox {
height: 60px;
width: 50px;
margin: 0;
position: absolute;
z-index: 1;
/* optionally hide the checkbox */
opacity: 0;
}
.toggle-switch {
background: var(--toggle-switch-bg);
height: 60px;
width: 60px;
border-radius: 40px;
position: absolute;
top: 5px;
left: 6px;
transition: left 1s ease-in-out;
}
.toggle-checkbox:checked + .toggle-switch{
left: 115px;
}