Skip to content

Commit 0b32870

Browse files
authored
feat: add faqs section
1 parent 53c9edf commit 0b32870

File tree

1 file changed

+230
-0
lines changed

1 file changed

+230
-0
lines changed

README.md

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The goal of the lab is to create a *responsive* landing page using **CSS** and *
1818
## Requirements
1919

2020
- Fork this repo
21+
2122
- Clone this repo
2223

2324

@@ -90,6 +91,7 @@ Use the following page screenshot as the guide:
9091
<img src="https://education-team-2020.s3.eu-west-1.amazonaws.com/web-dev/m1/lab-flexbox-slack/Slack+Home+Page+-+420px.png" width="200px"/>
9192
<br/>
9293

94+
9395
[Back to top](#iteration-1--mobile-screens-width--768px)
9496
</details>
9597

@@ -145,6 +147,7 @@ Use the following page screenshot as the guide:
145147
<img src="https://education-team-2020.s3.eu-west-1.amazonaws.com/web-dev/m1/lab-flexbox-slack/Slack+Home+Page+-+768px.png" width="550px"/>
146148
<br/>
147149

150+
148151
[Back to top](#iteration-2--small-screens-width--768px-and-width--1024px)
149152
</details>
150153

@@ -198,6 +201,7 @@ Use the following page screenshot as the guide:
198201
<br/>
199202

200203

204+
201205
[Back to top](#iteration-3--medium-screens-width--1024px-and-width--1440px)
202206
</details>
203207

@@ -251,6 +255,7 @@ Use the following page screenshot as the guide:
251255

252256

253257

258+
254259
[Back to top](#iteration-4--large-screens-width--1440px)
255260

256261
</details>
@@ -270,3 +275,228 @@ You can inspect the page styles here: [Figma file - Large Screens]()
270275

271276

272277
Happy coding! ❤️
278+
279+
280+
281+
## FAQs
282+
283+
284+
285+
<details>
286+
<summary>I am stuck in the exercise and don't know how to solve the problem or where to start.</summary>
287+
<br>
288+
289+
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.
290+
291+
292+
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.
293+
294+
295+
Once you have a clear understanding of the problem, you will be able to start working towards the solution.
296+
297+
[Back to top](#faqs)
298+
</details>
299+
300+
301+
302+
<details>
303+
<summary>How do I center align HTML text elements?</summary>
304+
<br>
305+
306+
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.
307+
308+
Here is an example of how you can use the `text-align` property to center align multiple text elements:
309+
310+
**HTML**
311+
312+
```html
313+
<div>
314+
<h2>This is a title</h2>
315+
316+
<p>This is some text in here</p>
317+
</div>
318+
```
319+
320+
**CSS**
321+
322+
```css
323+
/* CSS */
324+
325+
p {
326+
text-align: center; /* Center align all p elements */
327+
}
328+
329+
h2 {
330+
text-align: center; /* Center align all h2 elements */
331+
}
332+
```
333+
334+
This will center align all `p` and `h2` elements within the parent `div`.
335+
336+
For more information, check: [W3C: Centering Things](https://www.w3.org/Style/Examples/007/center.en.html)
337+
338+
[Back to top](#faqs)
339+
</details>
340+
341+
342+
343+
<details>
344+
<summary>How do I center align HTML block elements?</summary>
345+
<br>
346+
347+
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.
348+
349+
Here is an example of how you can do this:
350+
351+
**HTML**
352+
353+
```html
354+
<section>
355+
<div>
356+
<p> Lorem ipsum dolor sit amet consectetur, adipisicing elit.</p>
357+
</div>
358+
</section>
359+
```
360+
361+
**CSS**
362+
363+
```css
364+
/* CSS */
365+
366+
div {
367+
width: 500px;
368+
margin: 0 auto;
369+
}
370+
```
371+
372+
This will set the `widh` property of the `div` to 500 pixels and we set the left and right margin to be equal by using `margin: 0 auto;`.
373+
374+
[Back to top](#faqs)
375+
</details>
376+
377+
378+
379+
<details>
380+
<summary>How do I center align an HTML image element?</summary>
381+
<br>
382+
383+
There are a few ways you can center aling an image element.
384+
385+
##### 1. Align an image using `text-align`
386+
387+
To center an image element in HTML, you can use the `text-align` property on the parent element, such as `div`. Example:
388+
389+
**HTML**
390+
391+
```html
392+
<div>
393+
<img src="https://placehold.co/300x150.png" />
394+
</div>
395+
```
396+
397+
**CSS**
398+
399+
```css
400+
div {
401+
text-align: center;
402+
}
403+
```
404+
405+
This will center align all the children elements within the `section` element, including the `img` element.
406+
407+
<br>
408+
409+
##### 2. Align an image as a block element
410+
411+
The other way is converting the image into a block element and using `margin: 0 auto`. Here is an example:
412+
413+
**HTML**
414+
415+
```html
416+
<section>
417+
<img src="https://placehold.co/300x150.png" />
418+
</section>
419+
```
420+
421+
**CSS**
422+
423+
```css
424+
img {
425+
display: block;
426+
margin: 0 auto;
427+
}
428+
```
429+
430+
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.
431+
432+
[Back to top](#faqs)
433+
</details>
434+
435+
<details>
436+
<summary>How can I change the header from having 1 column to having 2 columns?</summary>
437+
<br>
438+
439+
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:
440+
441+
1. Use the `display` property and set it to `flex`.
442+
2. Add the `flex-direction` property and set it to `column` to arrange the elements in a column.
443+
3. Add the `justify-content` property to align the elements horizontally
444+
4. Use the `align-items` property to align them vertically.
445+
446+
```css
447+
header {
448+
display: flex;
449+
flex-direction: column; /* Arrange elements in a column */
450+
justify-content: space-between; /* Align horizontally */
451+
align-items: center; /* Align vertically */
452+
}
453+
```
454+
455+
456+
457+
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`:
458+
459+
```css
460+
@media (min-width: 800px) {
461+
header {
462+
flex-direction: row;
463+
}
464+
465+
/* Change the width of nested div elements */
466+
header > div {
467+
width: 50%;
468+
}
469+
}
470+
```
471+
472+
473+
474+
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.
475+
476+
[Back to top](#faqs)
477+
</details>
478+
479+
480+
481+
<details>
482+
<summary>Why are my media query styles not displaying properly on my browser?</summary>
483+
<br>
484+
485+
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.
486+
487+
488+
489+
There are a few possible reasons why your media query styles may not be displaying properly on your browser
490+
491+
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.
492+
2. Make sure that 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.
493+
3. Make sure that you have the correct syntax in your media query. The correct syntax is `@media (expression) {...}`.
494+
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) {...}.`
495+
496+
497+
498+
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)
499+
500+
[Back to top](#faqs)
501+
</details>
502+

0 commit comments

Comments
 (0)