<!DOCTYPE HTML> <html> <head> <title>Untitled</title> </head> <body> <canvas id="canvas" width="800" height="800"></canvas> <script> VarCanvas = document.getElementById("canvas"); ctx = VarCanvas .getContext('2d'); ctx.fillStyle = "#ff0000"; ctx.fillRect(1*100, 0, 1*100+100, 100) </script> </body> </html>