Skip to content
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

[css-grid] Clarify that line 1 is never implicit #5122

Closed
Loirooriol opened this issue May 27, 2020 · 2 comments
Closed

[css-grid] Clarify that line 1 is never implicit #5122

Loirooriol opened this issue May 27, 2020 · 2 comments

Comments

@Loirooriol
Copy link
Contributor

Consider https://software.hixie.ch/utilities/js/live-dom-viewer/saved/8137

#grid {
  display: grid;
  grid-template-columns: none;
  grid-template-areas: none;
}
#grid-item {
  grid-column-start: foo 1;
}

According to https://drafts.csswg.org/css-grid/#grid-placement-int,

If a name is given as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position.

There is no explicit line called foo, so grid-column-start: foo 1 should resolve to the 1st trailing implicit line. But, which one is the 1st one? According to https://drafts.csswg.org/css-grid/#implicit-grids,

The grid-template-rows, grid-template-columns, and grid-template-areas properties define a fixed number of tracks that form the explicit grid. When grid items are positioned outside of these bounds, the grid container generates implicit grid tracks by adding implicit grid lines to the grid.

So if there are n > 0 tracks in the explicit grid, then it's easy: the explicit grid is delimited by lines 1 and n+1, so the 1st trailing implicit line is the n+2.

But in this case we don't have any explicit column, i.e. we have n = 0. From https://drafts.csswg.org/css-grid/#grid-line-concept,

A grid line exists on either side of a column or row.

So if there is no explicit column, it wouldn't be unreasonable to think that there is no explicit line. That is, creating the 1st trailing implicit track would add two implicit lines, 1 and 2. Then, line 1 would be implicit.

However, we have interoperability that the 1st trailing implicit line is 2, not 1. I think this is good, just substitute n = 0 into the n+2 formula above, no need to special case n = 0.

So I think it should be clarified that line 1 (and -1) is never implicit, even if the explicit grid is empty. Or that line is 1 not considered to have all names.

@MatsPalmgren
Copy link

It's already defined by this, no?

If these properties don’t define any explicit tracks the explicit grid still contains one grid line in each axis.

@Loirooriol
Copy link
Contributor Author

Ah, thanks! I kind of remembered something like this, but was not able to find it, so I thought I was misremembering.

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

2 participants