rachelandrew / cssgrid-ama

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

Good Idea/Bad Idea: A minmax function in the spec for span count #55

Closed brob closed 7 years ago

brob commented 7 years ago

I was playing with some overlap fun in a codepen and thought to myself "Can I use this layout to also create circles?" Here's a link to the codepen (ignore ridiculous animations): http://codepen.io/brob/full/YZOrdq/

Setting vw heights for my row tracks seemed to make sense to make this work, but then I have a dynamic height content area.

This may just be something Grid isn't meant to do, but would it make sense in the spec (or does it exist) to give an element a min number of lines to span and a max number of lines to span depending on content.

Right now, a cell that has an auto size or an fr size will stretch the grid itself.

Was an interesting thought I had and I was wondering if this makes sense with the spec or if it's better served in other layout modes.

rachelandrew commented 7 years ago

I can't think of an existing way to make this work because you are relying on the grid to have equal track sizing for one thing, yet additionally need a track that expands. You can't have both.

The problem with a minmax tracks idea is what would happen to other content below that content? Does it also move down, does it get overlaid? Seems as if there would be a lot to consider from an author point of view to achieve a layout that behaves like that. That said, there is no reason not to post use cases like this to the CSS WG Issue tracker, if you search you'll find several potential css-grid-2 use cases and ideas - https://github.com/w3c/csswg-drafts/issues.