CSS and Canvas HTML5

As with most HTML elements, CSS can be applied to the canvas element itself to add borders, padding,
margins, etc. Additionally, some CSS values are inherited by the contents of the canvas; fonts are a good
example, as fonts drawn into a canvas default to the settings of the canvas element itself.
Furthermore, properties set on the context used in canvas operations follow the syntax you may
already be familiar with from CSS. Colors and fonts, for example, use the same notation on the context
that they use throughout any HTML or CSS document.
Browser Support for HTML5 Canvas
With the arrival of Internet Explorer 9, all browser vendors now provide support for HTML5 Canvas, and
it is already in the hands of a majority of users. This is a major milestone in web development, allowing
2D drawing to thrive on the modern Web.
In spite of the dwindling market share of previous versions of Internet Explorer, it is still a good idea
to first test whether HTML5 Canvas is supported before you use the APIs. The section “Checking for
Browser Support” later in this chapter will show you how you can programmatically check for browser
support.