forked from GCA-Classroom/02-prj-intel-sustainability
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle.css
More file actions
188 lines (170 loc) · 5.64 KB
/
style.css
File metadata and controls
188 lines (170 loc) · 5.64 KB
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
/* Add your CSS here */
/* Center the header image and set its size */
header img {
display: block; /* Makes the image take up its own line */
margin: 0 auto; /* Centers the image horizontally */
width: 6%; /* Sets the image width */
height: auto; /* Keeps the image's aspect ratio */
}
/* Make the header background navy blue */
header {
background-color: rgb(1, 1, 61); /* Sets the background color to navy blue */
text-align: center; /* Centers all header text */
}
/* Change the header title text color for better contrast */
header h1 {
color: white; /* White text stands out on a dark background */
font-size: 2.2em; /* Slightly larger title text */
}
/* Change the header subheading text color for better contrast */
header p {
color: #e0e0e0; /* Light gray for readability on dark background */
font-size: 1.2em; /* Slightly larger subheading text */
}
/* Timeline cards layout using flexbox and scroll snap */
section {
display: flex;
flex-wrap: nowrap; /* Prevent wrapping for horizontal scroll */
flex-direction: row; /* Horizontal layout */
justify-content: flex-start; /* Align cards to the left */
gap: 16px;
margin: 24px 0;
width: 100%;
max-width: 100vw;
box-sizing: border-box;
overflow-x: scroll; /* Always show horizontal scrollbar */
scrollbar-width: auto; /* Always show scrollbar in Firefox */
scroll-snap-type: x mandatory; /* Enable horizontal scroll snap */
-webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
padding-bottom: 16px; /* Space for scrollbar */
}
/* Use .timeline-card for all cards */
section > .timeline-card {
background: none;
border-radius: 8px;
box-shadow: none;
padding: 0;
width: 300px; /* Set card width */
height: 300px; /* Set card height to match width for square shape */
min-width: 300px; /* Prevent shrinking below square */
min-height: 300px;
max-width: 300px; /* Prevent growing beyond square */
max-height: 300px;
box-sizing: border-box;
margin-bottom: 16px;
position: relative;
overflow: hidden;
transition: transform 0.2s;
scroll-snap-align: start;
}
/* Make images inside cards fill the square and keep text inside */
section > .timeline-card img {
width: 100%;
height: 100%; /* Image fills the square card */
object-fit: cover; /* Crop image to fill area */
border-radius: 8px;
display: block;
}
/* Overlay for card text */
section > .timeline-card h2,
section > .timeline-card h3,
section > .timeline-card p {
position: absolute;
left: 0;
width: 100%;
padding: 0 10px;
color: #fff;
text-shadow: 0 2px 8px rgba(0,0,0,0.7);
box-sizing: border-box;
margin: 0;
/* Ensure overlay text stays within the card image */
max-width: 100%;
overflow-wrap: break-word;
word-break: break-word;
}
/* Add faded background to card headers for better focus */
section > .timeline-card h2,
section > .timeline-card h3 {
background: rgba(0, 0, 32, 0.4); /* Faded dark background */
border-radius: 4px;
}
section > .timeline-card h2 {
top: 12px;
font-size: 1.2em;
font-weight: bold;
text-align: center;
}
section > .timeline-card h3 {
top: 40px;
font-size: 1em;
text-align: center;
}
section > .timeline-card p {
bottom: 12px;
font-size: 0.95em;
text-align: center;
background: rgba(0,0,0,0.4);
border-radius: 4px;
padding: 6px 10px;
opacity: 0;
max-height: 60%; /* Prevent overlay text from overflowing image */
overflow-y: auto; /* Scroll if text is too long */
}
/* Show the card description text when hovering over the card */
section > .timeline-card:hover p {
opacity: 1; /* Make the text fully visible */
}
/* Also show the text when the paragraph is focused (for accessibility) */
section > .timeline-card p:focus {
opacity: 1;
}
/* Hide h2 and h3 text on card hover or focus */
section > .timeline-card:hover h2,
section > .timeline-card:focus h2,
section > .timeline-card:hover h3,
section > .timeline-card:focus h3 {
opacity: 0;
}
/* Make cards slightly larger when hovered or focused */
section > .timeline-card:hover,
section > .timeline-card:focus {
transform: scale(1.05); /* Slightly increase card size */
z-index: 1; /* Bring hovered card above others */
transition: transform 0.2s; /* Smooth scaling effect */
}
/* Responsive: Stack cards vertically on small screens with vertical scroll snap */
@media (max-width: 800px) {
section {
flex-direction: column; /* Stack cards vertically */
align-items: center;
overflow-x: scroll; /* Always show scrollbar on small screens too */
overflow-y: auto;
scrollbar-width: auto;
scroll-snap-type: y mandatory; /* Enable vertical scroll snap */
height: 80vh; /* Set a height for vertical scrolling */
max-width: 100%;
padding-bottom: 0;
}
section > .timeline-card {
width: 90vw; /* Responsive square: 90% of viewport width */
height: 90vw;
min-width: 200px;
min-height: 200px;
max-width: 350px;
max-height: 350px;
scroll-snap-align: start;
}
section > .timeline-card img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
/* Style the <p> at the bottom of the body */
body > p {
background-color: rgb(1, 1, 61); /* Same navy blue as header */
color: white; /* White text for contrast */
text-align: center; /* Center the text */
padding: 10px 0; /* Add some space above and below */
margin: 0; /* Remove default margin */
}