Prev Demo
HTML Canvas Rectangles
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <body> <canvas id="myCanvas" width="300" height="150" style="border:3px dotted black;"> </canvas> <script> var a = document.getElementById("myCanvas"); var b = a.getContext("2d"); b.rect(40, 40, 200, 100); b.stroke(); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output