HTML and CSS Reference
In-Depth Information
For our demonstration, instead of trying to use the font size to vertically center the text on the
canvas, we will create the yPosition variable for the text by simply placing it at one-half the
height of the canvas. The default baseline for a font is middle , so this works great for cen-
tering on the screen. We will talk more about baseline in the next section:
var
var yPosition = ( theCanvas . height / 2 );
NOTE
In the chat example in Chapter 11 , we will show you an example of breaking up text onto multiple
lines.
Search WWH ::




Custom Search