-1

I currently have this picture shown:

enter image description here

It is made by:

.gallery-grid {
     display: grid;
     grid-template-columns: repeat(4, 1fr);
 }

I've looked and it seems to not be possible to have each element only take up the space it needs instead of the height of the highest image? I've tried setting grid-auto-rows to auto and that does not change anything.

Any alternative solution to grid is fine also. I've tried flexbox and setting the flex-basis but can't seem to get that working either.

Vincent Nguyen
  • 1,555
  • 4
  • 18
  • 33

1 Answers1

0

Easy answer that doesn't require either grid or flexbox:

I simply set .gallery-grid to have column-width: 300px

enter image description here

Vincent Nguyen
  • 1,555
  • 4
  • 18
  • 33