rachelandrew / cssgrid-ama

Ask me anything about CSS Grid Layout
328 stars 12 forks source link

How to make the last grid item fill the grid remaining space? #144

Closed ChucKN0risK closed 6 years ago

ChucKN0risK commented 6 years ago

Hello,

Here's a simple grid: https://codepen.io/ChucKN0risK/pen/zaWQOm

I want my "space filler" item to fill the grid remaining space but only when the last row has more than one grid item.

Is this even possible?

Thanks in advance and have a nice day 😉

ChucKN0risK commented 6 years ago

I did have an answer on StackOverflow telling me that the container has no concept of when its children wrap. So it won't know when the last row has more than one item. I need to use media queries or JS.

Here's my JS solution 😉 https://codepen.io/ChucKN0risK/pen/zaWQOm