Skip to content

Commit 2cef0c2

Browse files
author
ChowSengFung
committed
section 8
1 parent 81e8ee2 commit 2cef0c2

File tree

4 files changed

+330
-8
lines changed

4 files changed

+330
-8
lines changed

starter/08-Omnifood-Responsive/css/general.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Default: 1
1515
Small: 1.05
1616
Medium: 1.2
1717
Paragraph default: 1.6
18+
Large: 1.8
1819
1920
- Letter spacing
2021
-0.5px
@@ -67,13 +68,15 @@ html {
6768
/* 10px / 16px = 0.625 = 62.5% */
6869
/* Percentage of user's browser font-size setting */
6970
font-size: 62.5%;
71+
overflow-x: hidden; /*for the mobile navigation */
7072
}
7173

7274
body {
7375
font-family: "Rubik", sans-serif;
7476
line-height: 1;
7577
font-weight: 400;
7678
color: #555;
79+
overflow-x: hidden; /*for the mobile navigation */
7780
}
7881

7982
/**************************/
@@ -249,6 +252,7 @@ body {
249252
display: flex;
250253
align-items: center;
251254
gap: 1.6rem;
255+
line-height: 1.2;
252256
}
253257

254258
.list-icon {
Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
/* rem and em do not depend on
2+
html font-size in media queries!
3+
Instead, 1rem = 1em = 16px */
4+
5+
/**************************/
6+
/* BELOW: 1344px (smaller desktops)*/
7+
/**************************/
8+
@media (max-width: 84em) {
9+
.hero {
10+
max-width: 120rem;
11+
}
12+
13+
.heading-primary {
14+
font-size: 4.4rem;
15+
}
16+
17+
.gallery {
18+
grid-template-columns: repeat(2, 1fr);
19+
}
20+
}
21+
22+
/**************************/
23+
/* BELOW: 1200px (landscape tablet)*/
24+
/**************************/
25+
26+
@media (max-width: 75em) {
27+
html {
28+
/* 9px / 16px */
29+
font-size: 56.25%;
30+
}
31+
32+
.grid {
33+
column-gap: 4.8rem;
34+
row-gap: 6.4rem;
35+
}
36+
37+
.heading-secondary {
38+
font-size: 3.6rem;
39+
}
40+
41+
.heading-tertiary {
42+
font-size: 2.4rem;
43+
}
44+
45+
.header {
46+
padding: 0 3.2rem;
47+
}
48+
49+
.main-nav-list {
50+
gap: 3.2rem;
51+
}
52+
53+
.hero {
54+
gap: 4.8rem;
55+
}
56+
57+
.testimonials-container {
58+
padding: 9.6rem 3.2rem;
59+
}
60+
}
61+
62+
/**************************/
63+
/* BELOW: 944px (tablet)*/
64+
/**************************/
65+
66+
@media (max-width: 59em) {
67+
html {
68+
/* 8px / 16px */
69+
font-size: 50%;
70+
}
71+
72+
.hero {
73+
grid-template-columns: 1fr;
74+
padding: 0 8rem;
75+
gap: 6.4rem;
76+
}
77+
78+
.hero-text-box,
79+
.hero-img-box {
80+
text-align: center;
81+
}
82+
83+
.hero-img {
84+
width: 60%;
85+
}
86+
87+
.delivered-meals {
88+
justify-content: center;
89+
margin-top: 3.2rem;
90+
}
91+
92+
.logos img {
93+
height: 2.4rem;
94+
}
95+
96+
.step-number {
97+
font-size: 7.4rem;
98+
}
99+
100+
.meal-content {
101+
padding: 2.4rem 3.2rem 3.2rem;
102+
}
103+
104+
.section-testimonials {
105+
grid-template-columns: 1fr;
106+
}
107+
108+
.gallery {
109+
grid-template-columns: repeat(6, 1fr);
110+
}
111+
112+
.cta {
113+
grid-template-columns: 3fr 2fr;
114+
}
115+
116+
.cta-form {
117+
grid-template-columns: 1fr;
118+
}
119+
120+
.btn--form {
121+
margin-top: 1.2rem;
122+
}
123+
124+
/* MOBILE NAVIGATION */
125+
.btn-mobile-nav {
126+
display: block;
127+
}
128+
129+
.main-nav {
130+
background-color: rgba(255, 255, 255, 0.97);
131+
position: absolute;
132+
top: 0;
133+
left: 0;
134+
width: 100%;
135+
height: 100vh;
136+
transform: translateX(100%);
137+
138+
display: flex;
139+
align-items: center;
140+
justify-content: center;
141+
transition: all 0.5s ease-in;
142+
143+
/* Hide Navigation */
144+
/* if set to display:none, cannot use transitions at all */
145+
/* display: none; */
146+
147+
/* step 1) Hide it visually */
148+
opacity: 0;
149+
150+
/* step 2) Make it unaccessible to mouse and keyboard. e.g. tab key, and mouse click */
151+
pointer-events: none;
152+
153+
/* 3)Hide it from screen readers */
154+
visibility: none;
155+
}
156+
157+
.nav-open .main-nav {
158+
opacity: 1;
159+
pointer-events: auto;
160+
visibility: visible;
161+
transform: translateX(0);
162+
}
163+
164+
.nav-open .icon-mobile-nav[name="close-outline"] {
165+
display: block;
166+
}
167+
168+
.nav-open .icon-mobile-nav[name="menu-outline"] {
169+
display: none;
170+
}
171+
172+
.main-nav-list {
173+
flex-direction: column;
174+
gap: 4.8rem;
175+
}
176+
177+
.main-nav-link:link,
178+
.main-nav-link:visited {
179+
font-size: 3rem;
180+
}
181+
}
182+
183+
/**************************/
184+
/* BELOW: 704px (smaller tablet)*/
185+
/**************************/
186+
187+
@media (max-width: 44em) {
188+
.grid--3-cols,
189+
.grid--4-cols {
190+
grid-template-columns: repeat(2, 1fr);
191+
}
192+
193+
.diets {
194+
grid-column: 1/-1;
195+
justify-self: center;
196+
}
197+
198+
.heading-secondary {
199+
margin-bottom: 4.8rem;
200+
}
201+
202+
.pricing-plan {
203+
width: 100%;
204+
}
205+
206+
.grid--footer {
207+
grid-template-columns: repeat(6, 1fr);
208+
}
209+
210+
.logo-col,
211+
.address-col {
212+
grid-column: span 3;
213+
}
214+
.nav-col {
215+
grid-row: 1;
216+
grid-column: span 2;
217+
margin-bottom: 3.2rem;
218+
}
219+
}
220+
221+
/**************************/
222+
/* BELOW: 544px (Phones)*/
223+
/**************************/
224+
225+
@media (max-width: 34em) {
226+
.grid {
227+
row-gap: 4.8rem;
228+
}
229+
230+
.grid--2-cols,
231+
.grid--3-cols,
232+
.grid--4-cols {
233+
grid-template-columns: 1fr;
234+
}
235+
236+
.btn,
237+
.btn:link,
238+
.btn:visited {
239+
padding: 2.4rem 1.6rem;
240+
}
241+
242+
.section-hero {
243+
padding: 2.4rem 0 6rem 0;
244+
}
245+
246+
.hero {
247+
padding: 0 3.2rem;
248+
}
249+
250+
.hero-img {
251+
width: 80%;
252+
}
253+
254+
.logos img {
255+
height: 1.2rem;
256+
}
257+
258+
.step-img-box:nth-child(2) {
259+
grid-row: 1;
260+
}
261+
262+
.step-img-box:nth-child(6) {
263+
grid-row: 5;
264+
}
265+
266+
.step-img-box {
267+
transform: translateY(2.4rem);
268+
}
269+
270+
.testimonials {
271+
grid-template-columns: 1fr;
272+
}
273+
274+
.gallery {
275+
grid-template-columns: repeat(4, 1fr);
276+
gap: 1.2rem;
277+
}
278+
279+
.cta {
280+
grid-template-columns: 1fr;
281+
}
282+
283+
.cta-img-box {
284+
height: 32rem;
285+
grid-row: 1;
286+
}
287+
288+
.cta-text-box {
289+
padding: 3.2rem;
290+
}
291+
}

0 commit comments

Comments
 (0)