Skip to content

[css-grid] Editorial: Usage of "grid" instead "grid-template" shorthand in section 7.1 ? #1280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sunright opened this issue Apr 22, 2017 · 1 comment

Comments

@sunright
Copy link

sunright commented Apr 22, 2017

Editorial:
Please explain why CSS Grid Layout editors usage of "grid" instead of "grid-template" shorthand in section 7.1?

The first paragraph of Section 7.1 says:

The three properties grid-template-rows, grid-template-columns, and grid-template-areas together define the explicit grid of a grid container. The grid property is a shorthand that can be used to set all three at the same time.

Please note what is written in the second sentence:

grid property is a shorthand that can be used to set all three at the same time.
( I used bold text to high light a question I have.)

Question:
Can "grid-template" property be used to set all three at the same time?

I am interested in the editors answer. I believe the answer is : yes

So what is the purpose of not using "grid-template" over "grid"?

I believe "grid-template" would be more appropriate. The "grid" property makes changes other properties (gutter property), which "grid-template" does not do.

I would like to point out another reason for my confusion:
"grid-template" property definition is located in section labeled:
7.4. Explicit Grid Shorthand: the grid-template property

The grid-template property is a shorthand for setting grid-template-columns, grid-template-rows, and grid-template-areas in a single declaration.

It just seems like the editors are casually saying use "grid" property because it does the job and not pointing out the "grid" property changes things you might not want changed. Where using "grid-template" does just one thing really well with out changing any thing else.

I would like to propose two ways to rewrite the second sentence in Section 7.1:

  1. The grid-template is a shorthand property that can be used to set all three at the same time.
  2. The grid-template and grid are shorthand properties that can be used to set all three at the same time.

A change that includes "grid-template" would really help the readability of the Module and help explain the flexibility and possible issues of using shorthand properties.

Thank you for all your hard work and allowing the public to see and comment on the work at the W3C.

Robert DiBlasi
We all learn by sharing what we know

@fantasai
Copy link
Collaborator

fantasai commented Aug 9, 2017

Can "grid-template" property be used to set all three at the same time? I am interested in the editors answer. I believe the answer is : yes

Yes.

So what is the purpose of not using "grid-template" over "grid"?

grid also resets the implicit grid properties, which, unless the author specifically wants them to be not reset in order for earlier declarations to cascade through, is a good idea to protect against unintended values. See example of overly-specific declaration.

It just seems like the editors are casually saying use "grid" property because it does the job and not pointing out the "grid" property changes things you might not want changed. Where using "grid-template" does just one thing really well with out changing any thing else.

We chose to use grid for the reason above: we generally encourage the use of shorthands over longhands unless there is a specific expectation that the other longhands not be reset.

I believe "grid-template" would be more appropriate. The "grid" property makes changes other properties (gutter property), which "grid-template" does not do.

We just resolved to change this behavior about gutters, based on feedback from authors that it was making the grid shorthand not useful. :) See #1036. This change will appear in the next publication, and should hopefully be picked up by implementations soon.

A change that includes "grid-template" would really help the readability of the Module and help explain the flexibility and possible issues of using shorthand properties.

I have made this change, to explain both shorthands here, and added a sentence to the implicit grid section to also mention the grid shorthand.

Thank you for your feedback, it makes the spec better. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants