HTML grid over childs code example

Example 1: get adjacent cells in grid

x = 5
y = 5
#just add the target x and y to row and col to get adjacent positions
adjacent_positions = [[row + x ,col + y] for row in (-1,0,1) for col in (-1,0,1) if [row + x ,col + y] != [x,y]]
#output
#[[4, 4], [4, 5], [4, 6], [5, 4], [5, 6], [6, 4], [6, 5], [6, 6]]

#NOTE: without the if statement would produce a list including the target x and y

Example 2: choose grid position html

/* grid-column: <start> / <end>;  */
/* grid-row: <start> / span <length>;  */
/* i.e */
grid-column: 3 / span 2;
grid-row: 2 / 4;
grid-row: 4;

Tags:

Html Example