1

Im trying to recreate the following distribution on a CSS grid, but im not getting there.

enter image description here

I've tried the following:

display: inline-grid;
grid-template-columns: auto auto;

But the columns get the biggest element width in all the grid.

What im trying to do is fill the row with the most amount of elements as i can respecting the element aspect ratio and with a max height for each row.

I dont know if this is possible using a CSS grid or should i use other CSS layout?

I made a JS script that does this but im trying to make the same behaviour with CSS for better performance and less bugs.

EDIT Heights might be different for each row to adjust the ratios and prevent images croping.

enter image description here

Thanks

Fausto Sanchez
  • 483
  • 1
  • 7
  • 21

0 Answers0