-
Notifications
You must be signed in to change notification settings - Fork 8
/
timeline.css
216 lines (181 loc) · 4.95 KB
/
timeline.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*use the universal selector to set some styles*/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--white: #fff;
--light-blue: lightblue;
--color-blue: blue;
--color-dark-grey: #222831;
}
/*withe this font size, anywhere we use rem our styling, wl be translated to the rem X 10px, normally , 1
1 rem is 16px*/
html {
font-size: 10px;
}
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@1,500&display=swap');
body {
font-family: 'Open Sans', sans-serif;
}
/* Start Here */
.intro-text {
background-color: var(--color-dark-grey);
color: var(--white);
padding: 2rem 0;
}
.container {
margin: 0 auto;
padding: 0 20px;
text-align: center;
}
.intro-text h1 {
font-size: 2.5rem;
}
p {
font-size: 1.5rem;
padding-top: 2rem;
line-height: 1.6;
}
/*Timeline section*/
img {
width: 100%;
}
.timeline-section {
width: 100%;
overflow: hidden; /* creates block formatting context */
}
.timeline-section ul {
background: var(--light-blue);
padding: 5rem 0; /* padding top and bottom 5rem */
}
/*styling the liSt*/
.timeline-section ul li {
list-style: none;
position: relative;
width: 5px; /* set width to 5px then set background to lightblue for that width */
margin: 0 auto; /* center text */
padding-top: 5rem; /* separate each list with a padding-top of 5rem = 5 x 10px= 50px */
background: var(--color-blue);
}
/*use pseudo elements to style*/
/*This section will help us make the node-like structure - The circle*/
.timeline-section ul li::after {
content: "";/* The content attribute is required for pseudo-elements to render */
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 3rem;
height: 3rem;
border-radius: 50%;
background: inherit; /* inherits this property from its parent element */
}
/* Content box */
.timeline-section ul li div {
width: 40rem;
font-size: 1.2rem;
position: relative;
bottom: 0;
padding: 1.5rem;
/*glassmorphism effect*/
background: rgba(255,255,255,.2);
-webkit-backdrop-filter: blur(5px);
backdrop-filter: blur(5px);
box-shadow: 20px 20px 50px rgba(0, 0, 0, 0.5);
border-radius: 10px;
border-top: 2px solid rgba(255, 255, 255, 0.5);
border-left: 2px solid rgba(255, 255, 255, 0.5);
border-bottom: 2px solid rgba(255, 255, 255, 0.5);
border-right: 2px solid rgba(255, 255, 255, 0.5);
border: 1px solid rgba(255,255,255,0.2);
}
/* Triangle */
.timeline-section ul li div::before {
content: "";
position: absolute;
bottom: 7px;
width: 0;
height: 0;
border-style: solid;
}
/*This is to select the divs at odd position so we can separate the divs to the right part*/
.timeline-section ul li:nth-child(odd) div {
left: 45px; /* this style pushes the divs at odd number position to the right */
}
/*this showcases the triangle*/
.timeline-section ul li:nth-child(odd) div::before {
left: -15px;
border-width: 8px 16px 8px 0;
border-color: transparent var(--light-blue) transparent transparent;
}
/*This is to select the divs at even number position so we can separate the divs to the left part*/
.timeline-section ul li:nth-child(even) div {
left: -439px;
}
/*this showcases the triangle*/
.timeline-section ul li:nth-child(even) div::before {
right: -15px;
border-width: 8px 0 8px 16px;
border-color: transparent transparent transparent var(--light-blue);
}
/*style the time tag*/
time {
display: block;
font-size: 1.1rem;
font-weight: 800;
margin-bottom: 7px;
}
.timeline-section ul li::after {
transition: all 0.5s ease-in-out;
}
/*this changes the node content..giving it a background of white and making the border thicker*/
.timeline-section ul li.slide-in::after {
background: var(--white);
border: 3px solid var(--light-blue);
}
/* Hide event card initially */
.timeline-section ul li div {
visibility: hidden;
opacity: 0;
transition: all 0.5s ease-in-out;
}
.timeline-section ul li:nth-child(odd) div {
transform: translateX(20rem);
}
.timeline-section ul li:nth-child(even) div {
transform: translateX(-20rem);
}
/* display the event card */
.timeline-section ul li.slide-in div {
transform: none;
visibility: visible;
opacity: 1;
}
/* Tablet Width */
@media screen and (max-width: 900px) {
.timeline-section ul li div {
width: 25rem;
}
.timeline-section ul li:nth-child(even) div {
left: -289px;
}
}
/* Mobile width */
@media screen and (max-width: 600px) {
.timeline-section ul li {
margin-left: 2rem;
}
.timeline-section ul li div {
width: calc(100vw - 91px);
}
.timeline-section ul li:nth-child(even) div {
left: 45px;
}
.timeline-section ul li:nth-child(even) div::before {
left: -15px;
border-width: 8px 16px 8px 0;
border-color: transparent var(--light-blue) transparent transparent;
}
}