Canvas Text and CSS

The first thing you need to know about text on HTML5 Canvas is that it does not use CSS for style. While the properties of HTML5 Canvas look similar to CSS properties, they are not interchangeable. While your knowledge of CSS will help you understand text on the HTML5 Canvas, you can’t rely solely on that knowledge to be successful with Canvas text. That being said, Canvas can take advantage of fonts defined in a CSS file using @font-face, and can fall back to multiple different fonts if the defined font is not available.

Get HTML5 Canvas, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.