Currently the best option today to do this job is Masonry, but it’s very heavy and have dependency of jQuery. Please understand: this isn’t a problem is most cases, but in cases when perfomance and page weight matters, the best case is try other options: maybe pure CSS? It’s possible?