Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
[css-grid] How to distribute space using flex ratios when the sum is 0? #3694
This "according to the ratios" seems slightly ambiguous to me.
What if the sum of ratios is 0? Then each track should get a 0/0 fraction of the distributed space, doesn't make sense. I guess in this case space is distributed equally, like for non-flexible tracks.
I think it would be more clear if the algorithm said:
This should be in the real algorithm, https://drafts.csswg.org/css-grid/#extra-space, not as some kind of vague amendment in https://drafts.csswg.org/css-grid/#algo-spanning-flex-items
Alternatively, not sure if something special should happen when the sum of weights is less than 1, akin to
OK, yeah, we definitely need to fix the divide-by-zero case. :) I agree with the behavior you describe, but, while I think your weighting algorithm is very clever in how it can handle the space distribution of both steps, it makes the section a bit harder to digest. So I'm keeping the current structure, but adjusting the step that assigns weights to match your suggestion.
Agenda+ to request review.