Code
Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy HTML Canvas styleStroke Property with example</title> </head> <body> <h1>HTML Canvas styleStroke Property with example</h1> <canvas id="wikitechyCanvas" width="200" height="200" style="border:2px solid green;"> </canvas> <script> var ss = document.getElementById("wikitechyCanvas"); var ssx = ss.getContext("2d"); ssx.strokeStyle = "purple"; ssx.strokeRect(30, 30, 100, 150); </script> </body> </html>
Result