JSFiddle - React, Tailwind, and code Playground
by Emily Humphrey
HTML
<div class="container">
<div>
dsgs gdsgsd gdsgsgd sg
</div>
<div>
dsgsgd sgsdgdsgs gdsg
</div>
<div>
dsgsgdsgsdgdsg sgdsg dsgsgdsgsdgdsg
</div>
<div>sa
dsgsgdsg sdgdsgsgdsgsafa fsafsaf sdgdsgsgdsgsafa
</div>
<div>
dsgsgdsgsdgdsgsg dsgfsaf af
</div>
<div>
dsgsgdsgs dgdsgsgdsgdsgsgdsgsdgdsgs gdsgdsgsgdsgsdgdsgsgdsgdsgsgdsgsdgdsgsgdsg
</div>
<div>
dsgs gdsgsd gdsgsgd sg
</div>
<div>
dsgsgd sgsdgdsgs gdsg
</div>
<div>
dsgsgdsgsdgdsg sgdsg dsgsgdsgsdgdsg
</div>
<div>sa
dsgsgdsg sdgdsgsgdsgsafa fsafsaf sdgdsgsgdsgsafa
</div>
<div>
dsgsgdsgsdgdsgsg dsgfsaf af
</div>
<div>
dsgsgdsgs dgdsgsgdsgdsgsgdsgsdgdsgs gdsgdsgsgdsgsdgdsgsgdsgdsgsgdsgsdgdsgsgdsg
</div>
</div>
CSS
.container {
display: grid;
gap: 10px;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
grid-template-rows: masonry;
}
.container div {
background: red;
overflow: hidden;
}