It is necessary that we provide a width and height to the canvas
element. It is also advised that we add these attributes inline directly in the HTML and not in a separate CSS file.
Here, you can see a canvas element with width and height specified in the CSS pane.
Contrast this with this example, where
we provide the width and height to our
canvas element inline in HTML.
You can see that the two results are different. Without getting in details right now, let's choose one path and stick with it.
Moving forward, we will always create a canvas
element with inline width
andheight
attributes. We'll later see the advantages of this approach.