title: Flexbox - Repeat layout depending on items shown
body: <p>I am trying to create a masonry style layout using flexbox, I am aiming for something that looks like this..</p>
  
  <p><a href="https://i.stack.imgur.com/myKqi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/myKqi.jpg" alt="enter image description here"></a></p>
  
  <p>I can create the layout simply enough, but I would like the layout to repeat depending on the number of items shown.</p>
  
  <p>Anyone have an example of something similar or any guidance on how to tackle it?</p>
  
  <p>I was thinking of doing some PHP handling first to work out how many items there are and then generating the layout, not sure if this is the best way to achieve it though.</p>