JSFiddle - React, Tailwind, and code Playground

by Sergey khorev

HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <div class="container">
  <div class="item "><img src="https://skb44.ru/upload/1/12.png" alt=""></div>
  <div class="item break"><img src="https://skb44.ru/upload/1/12.png" alt=""></div>
  <div class="item break"><img src="https://skb44.ru/upload/1/12.png" alt=""></div>

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

</div>
</body>
</html>

CSS

.container {
  display: flex;
  flex-flow: column wrap;
  align-content: space-between;
  /* Your container needs a fixed height, and it 
   * needs to be taller than your tallest column. */
  height: 600px; 
}

.item {
  width: 32%;
  margin-bottom: 2%; /* Optional */
}

/* Re-order items into 3 rows */
.item:nth-child(4n+1) { order: 1; }
.item:nth-child(4n+2) { order: 2; }
.item:nth-child(4n+3) { order: 3; }
.item:nth-child(4n)   { order: 4; }

/* Force new columns */
.container::before,
.container::after {
  content: "";
  flex-basis: 100%;
  width: 0;
  order: 2;
}