Lesson 4 of 8
Layout with Flexbox
- 12 min
- 4 checks
- 3 hints
- Go to task
Goal
Arranging and spacing out elements
Explanation
Flexbox lines elements up in a row or a column. Just write display: flex on the container, the element that holds them, and they fall into line on their own.
Then you control how they're spread out with three properties: gap for the space between the elements, justify-content for distributing them along the row, and flex-wrap: wrap so they move onto a new line instead of getting squeezed on narrow screens.
The row follows the page's text direction: it starts from the left on a left-to-right page and from the right on a right-to-left page, so you never have to reverse anything yourself.
Your task
Put the three items in a single row with space between them, spread them out evenly, and make them wrap onto a new line when the screen gets narrow.
Checks
4 checks- The .row container is a flex container
- There is a gap of 12px or more between the items
- The items are spread out with space-between
- The items wrap onto a new line on narrow screens