The CSS Working Group is currently pursuing a way to do this in 100% CSS. Mozilla is proposing one way to do this — and has implemented the idea, so that people can try it out and see what they think. This works in April/May 2020.You can try it in Firefox Nightly. Type about:config in the URL bar. Then search for “masonry”. And set layout.css.grid-template-masonry-value.enabled to true.This is an experimental implementation — being discussed as a possible CSS specification. It is NOT yet official, and likely will change.