Code
Execute
<!DOCTYPE html> <html> <head> <title> Wikitechy HTML Canvas fillRect with example</title> </head> <h2>HTML Canvas fillRect with example</h2> <body> <canvas id="wikitechyCanvas" width="370" height="200" style="border:1px solid green;"> </canvas> <script> var a = document.getElementById("wikitechyCanvas"); var context = a.getContext("2d"); context.fillRect(90, 50, 170, 100); </script> </body> </html>
Result