> Firefox supports pure css masonry grid behind a flag.
That has less support than Bieber at a black metal festival though.
Here's[1] the columns (or flexbox) way of doing it. Note that images will be a bit strangely ordered (as you would read columns). That's not solvable without JS (AFAIK). That's why W3C/CSSWG is looking at possible solutions[2] that resulted in the Firefox experiment you're referencing.
EDIT: you could have a masonry style gallery with CSS only using the CSS columns property.