CSS CSS Flexbox Layout Flexbox Properties Wrapping Items and Distributing Space

Raeed Sabree
Raeed Sabree
10,664 Points

distribute the available space inside .row give .row the blexbox property and value that will place the first and last

items along its edges then equally distribute the space between the other items

style.css
/* Complete the challenge by writing CSS below */
.row
{
display: flex;
  flex-wrap: wrap;

}
index.html
<!DOCTYPE html>
<html>
<head>
  <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">
</head>
<body>
  <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>
  </div>
</body>
</html>

1 Answer

Adam Mould
Adam Mould
6,292 Points

You'd need to use justify-content: space-between;, so your final .row class will look like this:

.row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

CSS Tricks has a comprehensive flexbox guide which I reference quite a lot to help me with flexbox.