table, th, td { border: 1px solid black; border-collapse: collapse; } th, td { width: 2em; height: 2em; text-align: center; } input.number { width: 2em; } .canvascontainer { resize: horizontal; overflow: auto; width: 15em; } canvas { image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: -o-crisp-edges; image-rendering: pixelated; -ms-interpolation-mode: nearest-neighbor; width: 100%; height: auto; object-fit: contain; }