JSFiddle - React, Tailwind, and code Playground
HTML
<div class="pinterest">
<div style="height: 50px"></div>
<div style="height: 60px"></div>
<div style="height: 40px"></div>
<div style="height: 80px"></div>
<div style="height: 60px"></div>
<div style="height: 40px"></div>
<div style="height: 70px"></div>
<div style="height: 90px"></div>
<div style="height: 40px"></div>
<div style="height: 80px"></div>
<div style="height: 40px"></div>
<div style="height: 70px"></div>
<div style="height: 50px"></div>
<div style="height: 60px"></div>
<div style="height: 60px"></div>
<div style="height: 90px"></div>
</div>
CSS
div.pinterest {
width: 400px;
-moz-column-count: 4;
-moz-column-gap: 40px;
-webkit-column-count: 4;
-webkit-column-gap: 40px;
column-count: 4;
column-gap: 40px;
}
div.pinterest > div {
display: inline-block;
vertical-align: top;
width: 98px;
border: solid 1px gray;
box-shadow: 0 1px 5px #000;
margin: 0 0 20px;
}