for (let row=1; row<=9; ++row) { let y = -(row-1) * 62 for (let col=1; col<=7; ++col) { let x = -(col-1) * 62 console.log(`.known.block_${row}${col}{background-position:${x}px ${y}px}`) } }