<canvas id="canvas"></canvas>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

canvasW = canvas.width;
canvasH = canvas.height;

ctx.beginPath();
ctx.fillStyle = "green";
ctx.fillRect(canvasW/5, canvasH / 2, 200, 200);
ctx.fill();
ctx.fillStyle = "blue";
ctx.fillRect(canvasW/2, canvasH / 2, 200, 100);
ctx.fill();
ctx.strokeStyle = "red";
ctx.lineWidth = 10;
ctx.rect(canvasW/4, canvasH / 4, 200, 100);
ctx.stroke();
ctx.closePath();

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.