(In an on-going series.)
Grid-based algorithms for filling up space with boxes: (this is all HTML+CSS+Javascript)
The best LaTeX algorithms for space-filling revolve around column-balancing running text with floating boxes within. For arranging boxes as here, I’m not aware of any high-level tools, although ConTeXt may have some that I’m unaware of.