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] span count starts only on explicit grid? #4705
Comments
See https://drafts.csswg.org/css-grid/#explicit-grids
Otherwise the definition of the implicit grid would be circular, since it depends on the position of the grid items, which would depend on the implicit grid. |
that's about the "indexes"... what about the span counting? Can it start on implicit grid or explicit grid? Wait a second, does this whole thing just mean, we refer to the explicit grid for the numbering (everything relative to the original explicit grid), and never refer to the implicit grid, as it is a new coordinate system? That's all it means? (and do we ever refer to the implicit grid anyway? I think the coordinate system of the explicit grid and implicit grid are the same, unless if the implicit grid extended some grid lines either to the left or to the top of the explicit grid... in which case we can say the coordinate system shifted. But if we never use the implicit grid coordinate system ever, why bring it up? Why not just say everything is relative to the original explicit grid, and that's simple and clear?) |
Not sure what you mean. If you use If you use |
It is about: This question is about whether CSS grid "span counting" -- whether it should start on implicit grid line. In CSS Definitive Guide, 4th Ed, p. 695, it is said that box4 is where things really get interesting. It ends on the fifth row line, which is to say the second implicit grid line. It spans back three lines—and yet, it still starts on the same grid line as box3. This happens because spans have to start counting within the explicit grid. Once they start, they can continue on into the implicit grid (as happened with box2), but they cannot start counting within the implicit grid. Is it true? Or has there been a spec change? Can "span counting" start within implicit grid? |
If you have #grid { grid-template-rows: 2em 2em }
.box04 { grid-row: span 2 / 5 } Then the item is placed in a grid area that ends at the 5th row line (you start counting at the beginning of the explicit grid) and spans two rows backwards. That is, from line 3 to line 5. The line 3 just happens to be the end of the explicit grid, but this is not relevant here. So basically positive indexes count forwards from the start of the explicit grid, and negative indices count backwards from the end of the explicit grid. They may end up referring to implicit lines, but they are referred to with respect to the explicit grid. |
so related to the if it is according to CSS Definitive Guide 4th Ed, we don't count the span starting on the implicit grid (line), but that we have to count starting from explicit grid (line), so we can't count it starting from line 5 but have to count it from line 3. But the reality is that it seems to count from line 5. |
|
shouldn't the logic be, you start at line 5 and count from line 5 for 4 steps? This is the most original definition. It can't be translated to form A if person A prefers it one way, and translated to form B if person B prefers it the other way: "it is the same as 1 / 5 and you start the counting from line 1". The key here is "where to start the counting" and you can't randomly choose to start counting at line 5 or line 1 as you want. |
With
So can you point out where's the problem? We are just going in circles. |
You do know that, in computer science, when we do Besides, in that code sample for box04, if I change it to |
@Loirooriol is exactly correct in their answers here. In If you reversed the values to I'm going to go ahead and close this issue, as your question has been answered. |
@tabatkins that really isn't what the question is. THE QUESTION IS: THERE SEEMS TO BE A RULE THAT SAYS COUNTING OF SPAN MUST START ON EXPLICIT GRID (EXPLICIT GRID LINE) (as in CSS Definitive Guide 4th Ed), but I don't see it actually happening. So I am wondering if this rule has been obsolete or what the real situation is? |
There is no such rule and never has been. I've never read "CSS Definitive Guide 4th Ed" and can't comment about what it may or may not say. I and Oriol have explained how lines and spans work; I encourage reading the spec to understand more. |
about span counting, was it not counting start at implicit grid line but the spec changed and now it start at implicit grid line? Or was it a terminology confusion -- could you add comments to this issue?
I can't find the related specs details on this topic.
https://stackoverflow.com/questions/59919727/in-css-grid-layout-do-we-count-the-span-even-starting-on-implicit-grid-lines
The text was updated successfully, but these errors were encountered: