So I have a collection of images of variable heights, and I'm displaying them in a three-column CSS grid – the result looks like this
Note the sequential numbering and the fact that a longer image can take up more of the column's height, but widths are fixed
The only way I know to implement this is with something like
<div class="grid">
<div class="col">
<div class="bear">...</div>
<div class="bear">...</div>
<div class="bear">...</div>
</div>
<div class="col">
<div class="bear">...</div>
<div class="bear">...</div>
<div class="bear">...</div>
</div>
<div class="col">
<div class="bear">...</div>
<div class="bear">...</div>
<div class="bear">...</div>
</div>
</div>
which works fine, but I want to make it responsive – specifically, such that the cards get stacked sequentially in a single column. I am not sure how to do this. Typically I'd arrange the elements by row and then compressing to a single column is easy, but if I were to arrange by row, I wouldn't get the dynamic height effect. Also, I could just stack each of these columns on top of each other, but then I lose the sequential nature of the bears.
Any ideas on what I can do?
Edit: Also note, I want the height to be dynamic – I shouldn't have to manually specify the height of each cell