freeCodeCamp Challenge Guide: Use the flex-direction Property to Make a Row

Use the flex-direction Property to Make a Row


Solutions

Solution 1 (Click to Show/Hide)

Once you have a flex container by adding display: flex; to the parent container, you can specify if you want the children to be stacked in a row by adding the following:

#box-container {
    display: flex; /* This makes the flex container */
    height: 500px;
    flex-direction: row-reverse; /* This makes the direction be a row with reversed elements */
  }

You will notice how the colors switch positions as the default direction of flex containers are rows as you might have noticed from the tweet example.

1 Like