Using Canvas to Create Online Ads
In this chapter, you use the Canvas API to create an online advertisement for Joe’s Pizza Co. (see Figure 14-1). This advertisement would be placed on other websites to help raise awareness of the Joe’s Pizza Co. brand and hopefully encourage more customers to eat at Joe’s.
Pizza image reproduced by permission of iStockphoto.com/Lauri Patterson
Figure 14-1 The advertisement you are going to create.
Setting Up Your Canvas
To create a canvas, you use the
<canvas> element. The default size of a canvas is 300 pixels wide and 150 pixels high. You can, however, change these default dimensions by adding
width attributes to the
<canvas> element, like so: