Flex-wrap Exercises

Let’s clean up the blogpost exercise. We will add the seventh post for the sake of dealing with the alignment of the last post too.

You will find the initial state in a code editor at the bottom of this section.

Exercise 1: Spacing

Separate the blog posts vertically with a 25px top and bottom margin.

Exercise 2: Left-aligning the last element

Remove the fixed-width constraint on the container. Align the last blog post to the left.

Exercise 3: Responsive breakpoints

In this exercise, we will violate the principles of mobile-first design to learn how it’s much easier.

Create a mobile layout, where the minimum width of each flex item is 225px, and the container expands fluidly until the 600px breakpoint. At or above the 600px breakpoint, display three blog posts next to each other. Try to write your code such that you don’t define the third breakpoint when three instead of two blog posts are displayed.

Set the max-width of the container to 800px.

Implement the mobile layout in the code editor below:

Get hands-on with 1400+ tech skills courses.