-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyles.css
75 lines (68 loc) · 1.7 KB
/
styles.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
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
color: #fff;
}
body {
display: flex;
justify-content: center;
align-items: center; /*it will make it vertically center but we
need to give height first
*/
min-height: 100vh; /*it will make it center*/
background-color: #008000;
}
.container {
position: relative;
}
.clock {
width: 300px;
height: 300px;
border-radius: 50%;
background-color: rgba(255, 0, 0);
border: 2px solid rgba(255, 0, 0, 0.25);
box-shadow: 0px 0px 30px rgba(0, 0, 0, 0.9);
display: flex;
justify-content: center;
align-items: center;
}
.clock span {
position: absolute;
transform: rotate(
calc(30deg * var(--i))
); /*here var() is a custom css varialbe and as there are 12 hours
and it is 360 degree circle we can 360/12 = 30 degree and we are multiplying
it var(--i) if i = 3 than it will 30 * 3 degree*/
inset: 12px; /*if not set inset it will not bring the digits in center*/
text-align: center; /*text-align center will bring digits inside the circle border*/
}
.clock span b {
/* we need to transform b tag transform rotate to negative value -30deg to
make all the digits vertically straight*/
transform: rotate(calc(-30deg * var(--i)));
display: inline-block; /*we need to inline-block because it is default is block*/
font-size: 20px;
}
.clock::before {
position: absolute;
content: "";
width: 8px;
height: 8px;
border-radius: 50%;
background-color: #fff;
}
.hand {
position: absolute;
display: flex;
justify-content: center;
align-items: flex-end;
}
.hand i {
position: absolute;
background-color: var(--clr);
width: 4px;
height: var(--h);
border-radius: 8px;
}