Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 6. HTML5 Drawing APIs > Solution 6-7: Working with relative font sizes ...

6.7. Solution 6-7: Working with relative font sizes to draw text on a canvas

Whenever you add text, you have to set its size. It can be fixed in pixels, but you can also set it relatively just as you can do with CSS.

6.7.1. What's involved

Just like every other element on your page, the <canvas> has a font size that is based on what you defined in your CSS. It's not different from what you are used to when dealing with your HTML4 page. Let's have a small recap of relative font size notions to understand how it works in canvas.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial