Re: [css3-grid-layout] [css3-layout] Grid-Template Declaration Merge

On 02/18/2012 04:56 AM, Phil Cupp wrote:
>
> Regarding grid-template being a shortcut that includes the ability to specify the sizes of each track, I'm not a fan of that syntax.  Here's why:
>
> 1. Aligning columns with their sizing functions seems like it breaks up the template to the point to where  tracking can become a problem and you lose the primary benefit of the template (seeing the shape and proportions of the grid via ascii-art).
> #grid {
>    grid-template:
>      "a                        b                        c"
>      "a                        d                        d"
>      "a                        e                        e"
>       minmax(min-content, 1fr) minmax(min-content, 1fr) minmax(min-content, 1fr);
> }
>
> vs
>
> #grid {
>    grid-template:
>      "abc"
>      "add"
>      "aee";
>    grid-columns: ( minmax(min-content, 1fr) )[3];
> }

There's no reason why you couldn't write that first declaration as

   grid: "abc"
         "add"
         "aee"
         ( minmax(min-content, 1fr) )[3];

If there's a shortcut, you have both options. Nothing requires you to space out
the column sizes. The advantage of the shortcut is that the rows can be spliced
in, e.g.

   grid: "abc" / min-content
         "add" / 1fr
         "aee" / min-content;

which is equivalent to

   grid-template: "abc"
                  "add"
                  "aee";
   grid-rows: min-content 1fr min-content;

> 2. Having grid-template as a shortcut that includes grid-rows and grid-columns means
> it resets those properties even when you don't specify their values.  I may be
> underestimating the typical author's understanding of shortcuts and specificity,
> but I anticipate confusion that:

I think you missed something here. I'm not proposing to make 'grid-template' a
shorthand that resets everything -- I agree that would be bad! I'm suggesting to
make a new property that's shorthand, that resets 'grid-template', 'grid-rows',
and 'grid-columns'. (Note, I'm not suggesting that we get rid of any of those
three sub-properties, or that we change their behavior!)

I think it's important to have a shorthand that resets everything, because as
we add new functionality, the author should have a way of knowing for sure
they're starting with a blank slate, regardless of what may have arrived through
the cascade.

~fantasai

Received on Tuesday, 21 February 2012 14:55:57 UTC