I don't get why the following pieces of code produce different results, because css would scale the canvas as it was zoomed in,
<style>
#canvas {
width: 800px;
height: 600px;
}
</style>
<canvas id="canvas"></canvas>
In contrast with this approach (that works as expected):
<canvas id="canvas" width="800px" height="600px"></canvas>
width
andheight
attributes of the canvas should not have dimensions (unlike CSS). You should havewidth="800"
, notwidth="800px"
. – Aksum