Skip to content

Commit e7375a8

Browse files
committed
Add exercise 10 on flexbox
1 parent 2d71919 commit e7375a8

File tree

7 files changed

+62
-5
lines changed

7 files changed

+62
-5
lines changed

css/week2-flexbox.css

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.site-wrapper {
2+
max-width: 800px;
3+
margin-left: auto;
4+
margin-right: auto;
5+
}
6+
7+
.countries + .site-header {
8+
margin-top: 2rem;
9+
}
10+
11+
.country {
12+
margin-top: 0;
13+
}
14+
15+
@media (min-width: 800px) {
16+
.site-wrapper {
17+
max-width: 800px;
18+
margin: 2rem auto;
19+
border-radius: 3px;
20+
}
21+
}

css/week2.css

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@ body {
2424

2525
.country {
2626
display: block;
27+
margin-top: 0.5rem;
2728
padding: 1rem;
2829
background: #fff;
2930
border: 1px solid rgba(0,0,0,0.2);
3031
border-radius: 2px;
3132
}
3233

33-
.country + .country {
34-
margin-top: 0.5rem;
35-
}
36-
3734
@media (min-width: 1200px) {
3835
.site-wrapper {
3936
margin: 2rem auto;

images/9-result.png

5.41 KB
Loading

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"6": "live-server --open=week-1/6-css-properties",
1515
"7": "live-server --open=week-1/7-css-box",
1616
"8": "live-server --open=week-1/8-git-branch",
17-
"9": "live-server --open=week-2/9-media-queries"
17+
"9": "live-server --open=week-2/9-media-queries",
18+
"10": "live-server --open=week-2/10-flexbox"
1819
}
1920
}

week-2/10-flexbox/flexbox.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Add your own CSS code below */

week-2/10-flexbox/index.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>10 - Flexbox - HTML, CSS and Git Exercises</title>
7+
<link rel="stylesheet" href="/css/normalize.css">
8+
<link rel="stylesheet" href="/css/week2.css">
9+
<link rel="stylesheet" href="/css/week2-flexbox.css">
10+
<link rel="stylesheet" href="flexbox.css">
11+
</head>
12+
13+
<body>
14+
<div class="site-wrapper site-wrapper">
15+
<ul class="countries">
16+
<li class="country">1. Brazil</li>
17+
<li class="country">2. Croatia</li>
18+
<li class="country">3. Ethiopia</li>
19+
<li class="country">4. Laos</li>
20+
<li class="country">5. Uganda</li>
21+
</ul>
22+
</div>
23+
</body>
24+
25+
</html>

week-2/10-flexbox/readme.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Flexbox
2+
3+
Flexbox is used to change the layout of elements on the HTML page. In this exercise, you'll apply the `flex-direction` property to change how the countries are displayed. Follow the steps below to complete this exercise.
4+
5+
1. Open `flexbox.css` and write a CSS rule to apply `display: flex` to the "container" element. _Hint: The "container" element will be the parent element of each country._
6+
2. Use the property `flex-direction` to make the countries start from the right instead of the left.
7+
8+
_Hint: You can review how `flex-direction` works in [this guide](https://css-tricks.com/snippets/css/a-guide-to-flexbox/#article-header-id-3)._
9+
10+
When you're finished, it should look like the image below.
11+
12+
![Screenshot of the country list flowing from right to left](/images/10-result.png)

0 commit comments

Comments
 (0)