Flex-wrap Solution

This lesson contains the solutions to the flex-wrap exercises in the previous lesson.

We'll cover the following...

Exercise 1

This is an easy exercise. To separate the rows vertically, all we need is one margin rule on the blog posts, setting the top and bottom margins to 25px:

margin: 25px auto;
Solution of Exercise 1

Exercise 2

First, we’ll remove the width of the container and change the justify-content setting to flex-start:

.container {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
}

Let’s also add a fixed width to the body to make sure we’re focusing on the same screen size:

body {
  width: 900px;
}

As a result, we have four posts in row one and three posts in ...