You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use the Slack app almost every day to keep our communications with our classmates and the **Ironhack** team, but today we will be focusing on their landing page. In today's lab, we'll recreate Slack's landing page while ensuring it's responsive and adapts well to different screens. You can see the web page that we will be cloning [here](https://www.figma.com/proto/k77VYVA70WcPYRLvg4QmIf/LAB-CSS-Slack-Clone?node-id=125%3A3&scaling=scale-down-width&page-id=125%3A2&starting-point-node-id=125%3A3&hide-ui=1).
10
10
11
11
12
-
13
12
The goal of the lab is to create a *responsive* landing page using **CSS** and **Flexbox**.
14
13
15
-
16
-
17
-
18
14
## Requirements
19
15
20
16
- Fork this repo
21
17
- Clone this repo
22
18
23
-
24
-
25
19
## Submission
26
20
27
21
- Upon completion, run the following commands:
@@ -40,12 +34,8 @@ The goal of the lab is to create a *responsive* landing page using **CSS** and *
40
34
41
35
The `starter_code` folder contains all the files you'll need. The `images` folder contains all the images you'll need for your page, although most of them are already displayed on the page.
42
36
43
-
44
-
45
37
**The `index.html` already contains all the text and content needed. We will be focusing on the CSS and styling!**
46
38
47
-
48
-
49
39
During each iteration, the first step you should do is to inspect the provided screenshots. These are included in each iteration, along with a preview of the final result. Use these as a starting point for implementing your styles.
50
40
51
41
<br />
@@ -58,7 +48,7 @@ The first step during every iteration will be to inspect the design files. These
58
48
59
49
Figma is great because it allows designers and developers to collaborate on projects while also making it simple to share and preview web page designs.
60
50
61
-
When you begin working as a developer, your team will likely use Figma to hand off to you the designs of the features you will be asked to create. We're going to assume you've never seen Figma before, so don't worry. The following short videos should get you up to speed:
51
+
When you begin working as a developer, your team will likely use Figma to hand off to you the designs of the features you will be asked to create. We're going to assume you've never seen Figma before, so don't worry. The following short videos should get you up to speed:
62
52
63
53
- [What is Figma?](https://www.youtube.com/watch?v=_d8GG2QZYAM)
64
54
- [Figma for Frontend developers [ in 5 minutes ]](https://www.youtube.com/watch?v=hbN9RGcQFNU)
@@ -79,8 +69,6 @@ We will start by focusing on the styles for mobile screens first! :iphone: Oh! R
79
69
80
70
When done, your page should look like this: [Preview - Mobile](https://www.figma.com/proto/k77VYVA70WcPYRLvg4QmIf/LAB-CSS-Slack-Clone?node-id=68%3A2762&scaling=scale-down&page-id=68%3A2761&starting-point-node-id=68%3A2762&show-proto-sidebar=1&hide-ui=1)
81
71
82
-
83
-
84
72
<br>
85
73
86
74
Use the following page screenshot as the guide:
@@ -90,13 +78,11 @@ Use the following page screenshot as the guide:
[Back to top](#iteration-1--mobile-screens-width--768px)
94
83
</details>
95
84
96
85
97
-
98
-
99
-
100
86
<!--
101
87
102
88
You can inspect the page styles here:
@@ -119,23 +105,16 @@ You can inspect the page styles here:
119
105
### Iteration 2 | Small Screens (width > 768px and width < 1024px)
120
106
121
107
Let's start growing our screen size. In this iteration, you will work on making the website look great on small screens (iPads, tablets, or larger smartphones). You will have to use CSS [media queries](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries) to apply the style and layout changes. Take a look at the preview and the screenshot to see the changes that are needed. Your task is to work on the following:
122
-
123
-
124
-
125
108
- The **header** should go from 1 column to display 2 columns: one with the content and buttons, and the other with the image.
126
109
- The **company logos** should be displayed in a single row.
127
110
- The **images** in the sections in the **main** part should be fully displayed and aligned to the left or right side of the page, respectively.
128
111
- The **section "Teams large and small rely on Slack"** should have the list items and the buttons displayed horizontally as rows.
129
112
- The **sub-footer** items, previously displayed as a column, should now be displayed in a single row.
130
113
131
-
132
-
133
114
<br>
134
115
135
116
When done, your page should look like this: [Preview - Small Screens](https://www.figma.com/proto/k77VYVA70WcPYRLvg4QmIf/LAB-CSS-Slack-Clone?node-id=49%3A1508&scaling=scale-down&page-id=68%3A2976&starting-point-node-id=49%3A1508&hide-ui=1)
136
117
137
-
138
-
139
118
<br>
140
119
141
120
Use the following page screenshot as the guide:
@@ -145,6 +124,7 @@ Use the following page screenshot as the guide:
[Back to top](#iteration-2--small-screens-width--768px-and-width--1024px)
149
129
</details>
150
130
@@ -159,35 +139,22 @@ You can inspect the page styles here:
159
139
-->
160
140
161
141
162
-
163
-
164
-
165
142
<br>
166
143
167
-
168
-
169
144
----
170
145
171
146
172
-
173
147
### Iteration 3 | Medium Screens (width > 1024px and width < 1440px)
174
148
175
-
We'll continue by focusing on devices with medium-sized screens (notebooks and bigger tablets). Similar to the previous iteration, you will have to use CSS media queries to apply the style and layout changes. The most noticeable changes for this viewport size are:
176
-
177
-
178
-
149
+
We'll continue by focusing on devices with medium-sized screens (notebooks and bigger tablets). Similar to the previous iteration, you will have to use CSS media queries to apply the style and layout changes. The most noticeable changes in this viewport size are:
179
150
- The **navbar** should now display all the menu links. The previously displayed menu icon should now be hidden.
180
151
- The **sections** in the **main** part should now display the content in 2 columns: one column for the heading and text, and the other for the image.
181
152
- The **section "Welcome to your new digital HQ"** should now have the buttons displayed horizontally as rows.
182
153
183
-
184
-
185
154
<br>
186
155
187
156
When done, your page should look like this: [Preview - Medium Screens](https://www.figma.com/proto/k77VYVA70WcPYRLvg4QmIf/LAB-CSS-Slack-Clone?node-id=49%3A2159&scaling=scale-down&page-id=68%3A2977&starting-point-node-id=49%3A2159&hide-ui=1)
188
157
189
-
190
-
191
158
<br>
192
159
193
160
Use the following page screenshot as the guide:
@@ -197,7 +164,6 @@ Use the following page screenshot as the guide:
[Back to top](#iteration-3--medium-screens-width--1024px-and-width--1440px)
202
168
</details>
203
169
@@ -225,21 +191,13 @@ You can inspect the page styles here:
225
191
### BONUS: Iteration 4 | Large Screens (width > 1440px)
226
192
227
193
Last one! Some small changes and we are done! In this iteration we are targeting large-screen devices such as desktops and laptops:
228
-
229
-
230
-
231
194
- The **signup buttons** in the **header** should now be displayed horizontally, next to each other.
232
-
233
195
- Additionally, the image shown in the **header** should be centered and fully visible.
234
196
235
-
236
-
237
197
<br>
238
198
239
199
When done, your page should look like this: [Preview - Large Screens](https://www.figma.com/proto/k77VYVA70WcPYRLvg4QmIf/LAB-CSS-Slack-Clone?node-id=49%3A2489&scaling=scale-down&page-id=68%3A2978&starting-point-node-id=49%3A2489&hide-ui=1)
240
200
241
-
242
-
243
201
<br>
244
202
245
203
Use the following page screenshot as the guide:
@@ -249,8 +207,6 @@ Use the following page screenshot as the guide:
[Back to top](#iteration-4--large-screens-width--1440px)
255
211
256
212
</details>
@@ -263,10 +219,223 @@ You can inspect the page styles here: [Figma file - Large Screens]()
263
219
264
220
-->
265
221
222
+
<br />
266
223
267
224
268
-
<br />
269
225
226
+
Happy coding! :heart:
227
+
228
+
<br>
229
+
230
+
## FAQs
231
+
232
+
<br>
233
+
234
+
<details>
235
+
<summary>I am stuck in the exercise and don't know how to solve the problem or where to start.</summary>
236
+
<br>
237
+
238
+
If you are stuck in your code and don't know how to solve the problem or where to start, you should take a step back and try to form a clear question about the specific issue you are facing. This will help you narrow down the problem and come up with potential solutions.
239
+
240
+
241
+
For example, is it a concept that you don't understand, or are you receiving an error message that you don't know how to fix? It is usually helpful to try to state the problem as clearly as possible, including any error messages you are receiving. This can help you communicate the issue to others and potentially get help from classmates or online resources.
242
+
243
+
244
+
Once you have a clear understanding of the problem, you will be able to start working toward the solution.
245
+
246
+
[Back to top](#faqs)
247
+
</details>
248
+
249
+
250
+
251
+
<details>
252
+
<summary>How do I center align HTML text elements?</summary>
253
+
<br>
254
+
255
+
To center align HTML *text elements*, you can use the `text-align` property and set it to `center`. This property can be applied to any *inline* or *block-level* element.
256
+
257
+
Here is an example of how you can use the `text-align` property to center align multiple text elements:
258
+
259
+
**HTML**
260
+
261
+
```html
262
+
<div>
263
+
<h2>This is a title</h2>
264
+
265
+
<p>This is some text in here</p>
266
+
</div>
267
+
```
268
+
269
+
**CSS**
270
+
271
+
```css
272
+
/* CSS */
273
+
274
+
p {
275
+
text-align: center; /* Center align all p elements */
276
+
}
277
+
278
+
h2 {
279
+
text-align: center; /* Center align all h2 elements */
280
+
}
281
+
```
282
+
283
+
This will center align all `p` and `h2` elements within the parent `div`.
284
+
285
+
For more information, check: [W3C: Centering Things](https://www.w3.org/Style/Examples/007/center.en.html)
286
+
287
+
[Back to top](#faqs)
288
+
</details>
289
+
290
+
291
+
292
+
<details>
293
+
<summary>How do I center align HTML block elements?</summary>
294
+
<br>
295
+
296
+
To center align a block-level element, such as a `div`, `h1`, etc., you can use the `margin` property and set it to `auto`. This will center the element horizontally within its parent container.
297
+
298
+
Here is an example of how you can do this:
299
+
300
+
**HTML**
301
+
302
+
```html
303
+
<section>
304
+
<div>
305
+
<p> Lorem ipsum dolor sit amet consectetur, adipisicing elit.</p>
306
+
</div>
307
+
</section>
308
+
```
309
+
310
+
**CSS**
311
+
312
+
```css
313
+
/* CSS */
314
+
315
+
div {
316
+
width: 500px;
317
+
margin: 0auto;
318
+
}
319
+
```
320
+
321
+
This will set the `width` property of the `div` to 500 pixels and we set the left and right margins to be equal by using `margin: 0 auto;`.
322
+
323
+
[Back to top](#faqs)
324
+
</details>
325
+
326
+
<details>
327
+
<summary>How do I center align an HTML image element?</summary>
328
+
<br>
329
+
330
+
There are a few ways you can center align an image element.
331
+
332
+
##### 1. Align an image using `text-align`
333
+
334
+
To center an image element in HTML, you can use the `text-align` property on the parent element, such as `div`. Example:
335
+
336
+
**HTML**
337
+
338
+
```html
339
+
<div>
340
+
<imgsrc="https://placehold.co/300x150.png" />
341
+
</div>
342
+
```
343
+
344
+
**CSS**
345
+
346
+
```css
347
+
div {
348
+
text-align: center;
349
+
}
350
+
```
351
+
352
+
This will center align all the children elements within the `section` element, including the `img` element.
353
+
354
+
<br>
355
+
356
+
##### 2. Align an image as a block element
357
+
358
+
The other way is converting the image into a block element and using `margin: 0 auto`. Here is an example:
359
+
360
+
**HTML**
361
+
362
+
```html
363
+
<section>
364
+
<imgsrc="https://placehold.co/300x150.png" />
365
+
</section>
366
+
```
367
+
368
+
**CSS**
270
369
370
+
```css
371
+
img {
372
+
display: block;
373
+
margin: 0auto;
374
+
}
375
+
```
376
+
377
+
This will center the image horizontally within the parent `section` element. The `display: block` property is used to make the image a *block-level* element, allowing the `margin: 0 auto` property to work. The `margin: 0 auto` property sets the left and right margins to be equal, centering the element within its parent container.
378
+
379
+
[Back to top](#faqs)
380
+
</details>
381
+
382
+
<details>
383
+
<summary>How can I change the header from having 1 column to having 2 columns?</summary>
384
+
<br>
385
+
386
+
To change the header of an HTML page from having one column to having two columns using Flexbox, you should do the following in your CSS:
387
+
388
+
1. Use the `display` property and set it to `flex`.
389
+
2. Add the `flex-direction` property and set it to `column` to arrange the elements in a column.
390
+
3. Add the `justify-content` property to align the elements horizontally
391
+
4. Use the `align-items` property to align them vertically.
392
+
393
+
```css
394
+
header {
395
+
display: flex;
396
+
flex-direction: column; /* Arrange elements in a column */
To make the header responsive and change it to a two column layout on screens that are wider than 800 pixels, use a media query and set the `flex-direction` property to `row`:
403
+
404
+
```css
405
+
@media (min-width: 800px) {
406
+
header {
407
+
flex-direction: row;
408
+
}
409
+
410
+
/* Change the width of nested div elements */
411
+
header>div {
412
+
width: 50%;
413
+
}
414
+
}
415
+
```
416
+
417
+
On smaller screens, the header will maintain a single column layout, but on screens larger than 800 pixels wide, it will change to a two column layout.
418
+
419
+
[Back to top](#faqs)
420
+
</details>
421
+
422
+
<details>
423
+
<summary>Why are my media query styles not displaying properly on my browser?</summary>
424
+
<br>
425
+
426
+
When using media queries to create a responsive layout, it is recommended to start with the default styles for mobile (smaller) screens, and then use media queries at the end of your stylesheet to apply styles for each increasing viewport size.
427
+
428
+
429
+
430
+
There are a few possible reasons why your media query styles may not be properly displayed on your browser.
431
+
432
+
1. Check that you already have default styles for mobile screens, where applicable. These styles should be placed at the beginning of your stylesheet, before your media queries.
433
+
2. Make sure you have placed your media queries at the end of your stylesheet after your regular styles. This is because media queries are applied after regular styles, so if you place them before your regular styles, they will be overridden.
434
+
3. Make sure that you have the correct syntax in your media query. The correct syntax is `@media (expression) {...}`.
435
+
4. Make sure that you are using the correct media query expression. For example, if you are trying to target screens that are wider than 800 pixels, you should use the `min-width` in your expression, like this: `@media (min-width: 800px) {...}.`
436
+
437
+
For more information on CSS media queries, check: [MDN: Beginner's guide to media queries](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Media_queries)
0 commit comments