<canvas id="canvasId" style="width:600px; height:300px; border: 1px solid #888"></canvas>
var canvas = document.getElementById('canvasId');
ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.fillStyle= "green";
ctx.fillRect(0,0,100,300);
ctx.fillStyle= "rgb(255,255,255)";
ctx.fillRect(100,0,100,300);
ctx.fillStyle= "rgb(255,0,0)";
ctx.fillRect(200,0,100,300);
ctx.stroke();
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.