HTML and CSS Reference
result in Canvas receiving a default width and height from the browser. Note that you can
place whatever you want inside the <canvas> tag, because its contents are thrown out
when rendered. Create an empty game.js file and include it right next to index.html.
Listing 6.1. index.html—Default Canvas HTML
Verifying browser support
Refreshing your browser will remove the nested text inside your <canvas> element.
When a Canvas element is successfully rendered, all the content inside is removed, which
makes it a great place to include content or messages for browsers that can't support it.
You can access the Canvas API's context from <canvas> and store it in a variable. Code
used to render your Canvas would look something like the following two lines; you'll im-
plement it in the next section.
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');