CSS Grid Layout as masonry with 'grid-auto-flow: dense'.
Look at number of pics and the empty spaces inside grid when initial/dense value changes
Here is a v2 with lazy-load images https://escss.blogspot.com/2017/07/css-grid-layout-as-masonry.html
Here is another version:
a case study: Latest post of a blog
The titles & font sizes help to diversify the size of each area