3 ms·
I believe it's so that you can use -1 to refer to the last gridline. If it was 0-indexed there would be no way to target that final gridline, or there would be
by kybradeck 9y ago
I believe it's so that you can use -1 to refer to the last gridline. If it was 0-indexed there would be no way to target that final gridline, or there would be a one-off error when using negative numbers.
Example: https://css-tricks.com/things-ive-learned-css-grid-layout/#article-header-id-2 https://css-tricks.com/things-ive-learned-css-grid-layout/#a...
- deleted 9y ago[deleted]
- Bromskloss 9y agoCouldn't you still use -1 to refer to the last grid line (or was it grid element)? Python does it, for example.
- kybradeck 9y agoYes, but that would mean the first gridline == 0 and the last gridline == -1, instead of the way the spec is written today, where the first gridline == 1 and the last gridline == -1. For me, consistency wins here.