P
P
President422015-02-04 20:55:58
css
President42, 2015-02-04 20:55:58

How to move flexbox items in groups?

Here I have this code:

<div class="container">
  <div class="item"></div>
  <div class="item"></div>
  <div class="item"></div>
  <div class="item"></div>
</div>

.container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
}

.item {
  border: 1px solid white;
  height: 300px;
  width: 200px;
  margin-bottom: 20px;
}

Is there any way to make the .item elements wrap two at a time instead of one at a time? That is, so that the situation would not arise when there are three divs in the first line, and one in the second?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question