CSS CSS Flexbox Layout Flexbox Properties Wrapping Items and Distributing Space

linda Tsai
linda Tsai
2,504 Points

How come my answer is incorrect? I thought this is correct: flex-direction: column;

Did anyone put the same answer as I did and got it right?

/* Complete the challenge by writing CSS below */

.row {
  display: flex;
  flex-direction: column;
<!DOCTYPE html>
  <title>Flexbox Layout</title>
  <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="page.css">
  <link rel="stylesheet" href="style.css">
  <div class="row">
    <div class="item">Item 1</div>
    <div class="item">Item 2</div>
    <div class="item">Item 3</div>
    <div class="item">Item 4</div>
    <div class="item">Item 5</div>
    <div class="item">Item 6</div>

2 Answers

28,484 Points

Did anyone put the same answer as I did and got it right?

No, but you aren't the first to ask about this exact thing, in fact somebody (with the exact same code) made a post earlier this week.

I'll provide the same asnwer here that I proivded in that post:

A flex contained will always try to fit its items within a single line, changing the flex-direction only changes the direction of said line. It does not change the fact that it still does not wrap to other lines when it runs out of space.

The property that controls that behavior is flex-wrap. By setting flex-wrap to wrap flex will wrap to another line If it runs out of space.