I reviewed the questions here and followed the answers, but my canvas still has a low resolution:
CSS
#canvas { position: absolute; top: 0; left: 0; z-index: -1; }
JS: Initialize Canvas (once upon page load and again when the window is resized)
function initCanvas() { $('#canvas').width($(window).width()); $('#canvas').height($(window).height()); }
Line drawing with
var c = document.getElementById("canvas"); var ctx = c.getContext("2d"); ctx.moveTo(0,0); ctx.lineTo(200,100); ctx.stroke();
Result
Jsfiddle
You can see that the string is displayed in low resolution. I would like the canvas to be a full window, but it looks sharp.
NB: I use absolute position and z-index -1 for the canvas, because I would like it to appear behind something else, which I later add to the page.
source share