How to draw rectangle using Canvas and SVG using HTML 5 ?
You can draw a rectangle using the rect
method available with HTML canvas.
Example code:
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.rect(20, 20, 150, 100);
ctx.stroke();