Source Code:
(back to article)
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> <style type="text/css"> canvas { border: 1px solid black; } </style> </head> <body onload="paint()"> <script type="text/javascript"> function paint() { let canvas = document.getElementById("canvas"); let ctx = canvas.getContext("2d"); ctx.font = "40px serif"; ctx.fillText("Hello W3docs", 10, 100); } </script> <canvas id="canvas" width="250" height="250"></canvas> </body> </html>
Result:
Report an issue