Result Size: 625 x 664
x
 
<!DOCTYPE html>
<html>
<body>
<h1>HTML5 Canvas</h1>
<h2>Draw a Line</h2>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid grey;"></canvas>
<script>
// Create a canvas:
const canvas = document.getElementById("myCanvas");
const ctx = canvas.getContext("2d");
// Define a new path:
ctx.beginPath();
// Define a start point
ctx.moveTo(0,0);
// Define an end point
ctx.lineTo(200,100);
// Draw it
ctx.stroke();
</script>
</body>
</html>