I've found a workable CSS-only photo-grid:
https://css-tricks.com/seamless-responsive-photo-grid/
But the fill is vertical; that is, photo #2 is underneath photo #1 in the same column, rather than to the right of it. What I want is horizontal flow.
I can do this easily with JavaScript, but is there a way to do it with pure CSS?
Requirements:
- Wrapping must be automatic; I don't want to assign photos to rows.
- Left and right justification. The height of a row varies so that the photos in that row are flush to the left and right margins of the container.
The HTML should be extremely simple, something like this:
<div class='photo-container'>
<img src='...'>
<img src='...'>
<img src='...'>
...
</div>- Aspect ratio of photos must be maintained. [UPDATE]
Any ideas?