News for hackers. Stuff that matters.
Re:Grid Garden – A game for learning CSS grid by jwarren on Wednesday April 05, 2017 @06:33PM (#14046286)
Additionally, you can count from the last grid divider with minus numbers. You can have -1, but I can imagine some pushback against -0.
Re:Grid Garden – A game for learning CSS grid by ajross on Wednesday April 05, 2017 @11:56PM (#14047812)
Lots of languages (c.f. python) do negative indexes with the first one starting from zero. The last element is indeed -1, because the element selected is simply the array-size-modulus of the index. It wraps exactly how you expect, and a few tricks use this.

CSS grid's negative indexes, hilarious, don't even get this right. If the first element is 1 then the last must be 0, right? No, it's not. Nor is it -1. It's negative two. Don't ask. I don't know.

Re:Grid Garden – A game for learning CSS grid by jwarren on Thursday April 06, 2017 @03:15PM (#14053644)
You're not wrong on the first point, but I imagine consistency with the front and back of the index was on the spec designers minds.

I do have to point out that your second point is not correct. Remember it's not grid areas, it's grid dividers. So the final grid line <strong>is</strong> in fact -1.

See my very hasty little Codepen: https://codepen.io/jodi/pen/ZeNRJZ