Here is what w3shcools.com says about the canvas element:
Canvas has several methods for drawing paths, boxes, circles, text, and adding images.
Since this game will live in a web page, lets start by setting up an empty HTML document that will serve as a template.
<html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body> Pong 1.0<br> <!-- Create an HTML canvas and assign it an id. --> <canvas id="gameCanvas" width="750" height="550" style="border:1px solid #000000;"></canvas> <script> </script> </body> </html>
For this project, I gave the canvas an id name of “gameCanvas” and a size 750 pixels wide by 550 pixels high. Nothing is visible on the page yet except the word “Pong 1.0”, and a 1 pixel border around the canvas, which I added just to make the canvas visible at this point. The HTML template also has
Here is what the canvas looks like so far:
For more information about the HTML canvas element, see: