Edit in JSFiddle

var canvas = document.getElementById('canvas'),
    context = canvas.getContext('2d');

context.fillStyle = '#FF0000';
context.fillRect(10, 20, 80, 80);

context.fillStyle = '#00FF00';
context.fillRect(45, 50, 80, 80);

context.fillStyle = '#0000FF';
context.fillRect(90, 100, 80, 80);
<canvas id="canvas" width="200" height="200"></canvas>
#canvas {
    border: 1px solid black;
}