display: grid; grid-template-rows: masonry;
I have it behind a CSS test for the existence of the CSS property so it is only enabled if the browser supports it.