RE: [css-grid] Why only <length>s in *-gap?

> From: Marat Tanalin [mailto:mtanalin@yandex.ru]
> 26.03.2016, 00:52, "Greg Whitworth" <gwhit@microsoft.com>:
> >>  From: Francois Remy [mailto:francois.remy.dev@outlook.com]
> >>  I guess the use case for percentages is when the grid has a definite
size
> for
> >>  the grid-gap axis, right?
> >
> > This then brings up the potential for confusion though, if you set a
definite
> size then it will work as the author expected, if you don't then it won't
which
> will make the feature unintuitive.
> 
> FWIW, we have something like this for tables (percentage widths of cells
are
> treated differently depending on whether the table has explicit width),
and
> that's ok.

As an editor of the table spec, I have to disagree. Percentages work the
same in both cases, as far as I know.

The only difference I know of is when the table has "table-layout:fixed" in
which case Chrome does some different behavior which may (but I didn't
check) behave in a way that causes percentages to work differently in those
two cases. 

That being said, we certainly don't want to specify grids to work like
tables, anyway. I am more trying to understand the use case at this point
than trying to make any decision. My gut feeling is that now that we enabled
"justify-content: space-between" to work for grid tracks, the common use
case for percentage-based grid gaps should be fixed by using no grid gap,
and size the columns based on percentages that do not sum up to 100%. That
should make things work nicely.

The only time I can see this isn't working is when you want the grid gap to
be AT LEAST some percentage (like, grid-gap: 5%) of the explicit width of
the grid (which may be unknown because based on the parent width, like if
width:100%) but fit as many columns of a fixed width in there, adding the
extra space between the items using "justify-content: space-between".

Received on Friday, 25 March 2016 23:34:09 UTC