Implementing canvas
To add canvas on your HTML page, you need to define the height and width of your canvas in the <canvas></canvas>
tags as shown in the following:
<html> <head> <title>Canvas</title> </head> <body> <canvas id="canvasTest" width="200" height="100" style="border:2px solid #000;"> </canvas> </body> </html>
We have defined the canvas ID as canvasTest
, which will be used to play with the canvas. We used inline CSS on our canvas. The 2 px solid border is used to have a better view of the canvas.