Description
When defining a grid layout with multiple tracks of fractional units, the alignment of the grid-gap
property with relation to the overall grid does not align to the expected behavior of the specification.
Take for example, a grid layout of
grid-template-columns: 50fr 50fr;
grid-gap: 10px;
This layout will split each column evenly, resulting in a 5px gap on the left most column, and a 5px gap on the right most column.
However, expand this with a third column as such:
grid-template-columns: 50fr 25fr 25fr;
grid-gap: 10px;
This layout will split the two 25fr
columns evenly, as expected. However, the gap between the 50fr
column, and the 25fr
column will not be even. Rather, the entirety of the gap will be on the 50fr
side of the split.
This is a significant issues with more complex layouts, as the gap between children becomes unpredictable, and alignment of any meta-elements becomes impossible.
Spec:
https://www.w3.org/TR/css-grid-1/
Minimum Reproduction:
https://codesandbox.io/s/wild-leftpad-h2f782?file=/index.html