-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle.css
84 lines (83 loc) · 2.65 KB
/
style.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
:root {
--dark-color: #232323;
--light-color: #f4f4f4;
/* Feel free to adjust the size of the text and checkbox with this variable */
--checkbox-size: 4.5rem;
/* This value determines currently used hue in checkbox color scheme.
You can pick value from 0-360 like in the color wheel
If you want to determine your own color with HSL, try this HSL Calculator:
https://www.w3schools.com/colors/colors_hsl.asp
*/
--base-hue: 210;
--checkbox-color: hsl(var(--base-hue), 100%, 70%);
}
* {
padding: 0;
margin: 0;
}
body {
background-color: var(--dark-color);
font-family: Helvetica;
user-select: none;
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
label {
display: block;
position: relative;
cursor: pointer;
}
input[type='checkbox'] {
display: none;
}
input[type='checkbox'] ~ span {
position: relative;
color: var(--light-color);
font-size: var(--checkbox-size);
padding-left: calc(var(--checkbox-size) * 1.1);
}
input[type='checkbox'] ~ span::before {
content: '';
position: absolute;
left: 0;
top: calc(var(--checkbox-size) * .15);
width: calc(var(--checkbox-size) * .85);
height: calc(var(--checkbox-size) * .85);
border-radius: calc(var(--checkbox-size) * .15);
background-color: var(--checkbox-color);
box-shadow: 0 0 calc(var(--checkbox-size) * .1) calc(var(--checkbox-size) * .005) var(--checkbox-color);
}
input[type='checkbox'] ~ div::before,
input[type='checkbox'] ~ div::after {
content: '';
position: absolute;
top: calc(var(--checkbox-size) * .2);
left: calc(var(--checkbox-size) * .38);
width: calc(var(--checkbox-size) * .1);
height: calc(var(--checkbox-size) * .75);
border-radius: calc(var(--checkbox-size) * .15);
background-color: var(--light-color);
transition: all 700ms ease;
}
input[type='checkbox'] ~ div::before {
transform: rotate(45deg);
}
input[type='checkbox'] ~ div::after {
transform: rotate(-45deg);
}
input[type='checkbox']:checked ~ div::before {
top: calc(var(--checkbox-size) * .25);
left: calc(var(--checkbox-size) * .47);
height: calc(var(--checkbox-size) * .7);
transform: rotate(30deg);
}
input[type='checkbox']:checked ~ div::after {
top: calc(var(--checkbox-size) * .6);
left: calc(var(--checkbox-size) * .21);
height: calc(var(--checkbox-size) * .35);
transform: rotate(-45deg);
}