Skip to content

[css-grid-2] Clarify meaning of "one grid line in each axis" #11861

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
gitspeaks opened this issue Mar 7, 2025 · 4 comments
Closed

[css-grid-2] Clarify meaning of "one grid line in each axis" #11861

gitspeaks opened this issue Mar 7, 2025 · 4 comments
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-grid-2 Subgrid; Current Work

Comments

@gitspeaks
Copy link

I'm confused by this line from 7.1. The Explicit Grid:

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

Since tracks are spaces between two grid lines, having only one line per axis wouldn't form any tracks at all. Can someone explain what the spec means here?

The full paragraph from the spec:

The size of the explicit grid is determined by the larger of the number of rows/columns defined by grid-template-areas and the number of rows/columns sized by grid-template-rows/grid-template-columns. Any rows/columns defined by grid-template-areas but not sized by grid-template-rows/grid-template-columns take their size from the grid-auto-rows/grid-auto-columns properties. If these properties don’t define any explicit tracks the explicit grid still contains one grid line in each axis.

@Loirooriol
Copy link
Contributor

See #5122

@Loirooriol Loirooriol added css-grid-2 Subgrid; Current Work Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. labels Mar 7, 2025
@gitspeaks
Copy link
Author

gitspeaks commented Mar 7, 2025

I don’t understand why the spec requires a line 1 on each axis when no tracks are defined. What if we used an implicit grid from the start with grid-template-columns/rows: none, where lines are created only when items are placed—like grid-column: 1 generates lines 1 and 2, and grid-column: 5 extends it to lines 1–6? This is similar to how implicit tracks are added beyond the grid’s edge anyway (e.g., grid-column: 10 in a 3-column grid). So why is an initial line 1 necessary instead of just using this implicit approach? What do these starting reference lines actually give us?

@Loirooriol
Copy link
Contributor

It's not necessary. But the difference is observable, and the spec chose this behavior, which is also simpler to implement.

@gitspeaks
Copy link
Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-grid-2 Subgrid; Current Work
Projects
None yet
Development

No branches or pull requests

2 participants