// canvas definition standard variables canvas = document.getElementById('canvasArea'); context=canvas.getContext("2d"); // a2. text variables var xPos = canvas.width/2; var yPos = 30; // a3. attributes context.font = "15pt arial"; context.fillStyle = "black"; context.strokeStyle = "hotpink"; context.lineWidth = 1; // a4. center context.beginPath(); context.moveTo(xPos,0); context.lineTo(xPos,canvas.height); context.stroke(); // a5. text baseline examples context.textAlign = "right"; context.fillText("right",xPos,yPos*1); context.textAlign = "end"; context.fillText("end", xPos,yPos*2); context.textAlign = "center"; context.fillText("center",xPos,yPos*3); context.textAlign = "left"; context.fillText("left",xPos, yPos*4); context.textAlign = "start"; context.fillText("start", xPos, yPos*5);