0

I'm looking on a way to center last row items using CSS Grid as per the next image: https://i.stack.imgur.com/nBOpi.png

This is the current code, as you can see rows and columns are completely dynamic, trying to replicate zoom's call layout behaviour. I haven't been succesful on this part.

// Count is the number of items inside grid container.
const rows = Math.min(Math.round(count / 2), 2);
const columns = Math.round(count / rows);

const gridContainerStyle = {
  gridTemplateRows: `repeat(${rows}, 1fr)`,
  gridTemplateColumns: `repeat(${columns}, 1fr)`,
  gap: '10px'
}
Tomerikoo
  • 15,737
  • 15
  • 35
  • 52

0 Answers0