When designing a photo gallery using CSS Grid, how would you ensure that each row accommodates the tallest item without stretching the shorter ones?

  • Implement the grid-template-rows: repeat(auto-fill, minmax(100px, 1fr)); property on the grid container.
  • Set the grid-auto-rows: minmax(100px, auto); property on the grid items.
  • Use the align-items: stretch; property on the grid container.
  • Use the align-self: stretch; property on the grid items.
To ensure that each row accommodates the tallest item without stretching the shorter ones, set the grid-auto-rows property on the grid items using minmax with a specified minimum height. This allows the row to adjust based on the content's height while preventing excessive stretching.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *