rachelandrew / cssgrid-ama

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

Do children of auto-fit column tracks automatically span all tracks if the number of items is less than the number of tracks? #157

Closed morganfeeney closed 5 years ago

morganfeeney commented 5 years ago

Hi Rachel,

Here's the reduced test case

Screen shot: image

In the screenshot you'll notice that there are 5 column tracks, is the button spanning all 5 tracks? Visually, it appears to be the case, however, when I inspect the button there is no computed CSS rule that shows that information, e.g. I would possibly expect to see grid-column: span N.

rachelandrew commented 5 years ago

No they don't, but if you use auto-fit the empty tracks collapse to 0. Use auto-fill if you don't want that to happen.

morganfeeney commented 5 years ago

Thanks for the clarification! I was aiming for what I get with auto-fit.

Could the empty tracks be an issue for any reason that you can think of? I'm thinking that if I specified a number of columns for the items to span then that would be an issue, but in this case I want the items to fill the available space without doing that.

rachelandrew commented 5 years ago

Well it's fine if you will only ever have that one row, but as soon as you add items in a row below then the tracks won't be empty and it will revert to the same behaviour as auto-fill.

morganfeeney commented 5 years ago

Thanks!