5 ms·
Nice game! This made me uncomfortable though (about CSS grid, not about the game): grid-area: row start / column start / row end / column end; So you have to
by pidg 10y ago
Nice game!
This made me uncomfortable though (about CSS grid, not about the game):
grid-area: row start / column start / row end / column end;
So you have to put the rows (Y axis coordinates) first and columns (X axis coordinates) second, i.e. the opposite of how it's done in every other situation - i.e. draw_rect(start_x, start_y, end_x, end_y)
(1, 1, 3, 4) in every other language would draw a box 2 wide and 3 high, but in css grid it selects an area 3 wide and 2 high.
Also the fact it uses 'row' and 'column' to describe the gridlines rather than the actual rows and columns irked me.
I'm sure I'll get over it!
- chme 10y agoI am not a web developer and this kind of grid addressing bewildered me too. Why isn't 0 the left most line as column and the top most line as row. That would make so much more sense, IMO. What could be the reason they haven't done it this way? Or are 1 based arrays normal here?
- irishsultan 10y agoUnfortunately it's somewhat consistent with the rest of css (e.g. padding is top left bottom right)
- judah 10y agoSmall correction: padding is top right bottom left. In other words, clockwise.
- irishsultan 10y agoMakes more sense, I always forget, which is why I looked it up, but apparently I either misread something or I can't remember it for longer than 2 or 3 seconds.
- cr0sh 10y agoI always used the mnemonic "TRouBLe" to remeber the order. There was another one for a different CSS thing (that I'm blanking on) that was based on the word "love" or something like that...
- danadam 10y agoLoVe HAte, the order of pseudo classes: :link :visited :hover :active
- cr0sh 10y agoThat's it! Thank you!
- yellowapple 10y agoI'm starting to suspect that CSS was invented by Taylor Swift.
- deleted 10y ago[deleted]
- kenbellows 10y agoIndexing into 2D containers is often an exception to the "x, then y" rule; indexes are very often specified with "row, then column"[1]. It's true that this is different to Cartesian coordinates, but grid cells aren't points or locations on a Cartesian plane, they're members of a 2D container: the grid. 1: https://en.wikipedia.org/wiki/Index_notation#Two-dimensional_arrays https://en.wikipedia.org/wiki/Index_notation#Two-dimensional...
- yellowapple 10y agoThis is also consistent with how tables are typically laid out in HTML (cells/columns inside rows). Considering that grids are supposed to be the modern/responsive/semantic/etc. equivalent of table-based layout, the conventions here are not terribly surprising. That said, I don't tend to use the shorthands.