The <canvas> Tag in HTML 5
The canvas element creates a two-dimensional drawing surface which can be used to draw images using 2-D drawing functions. It can be used to create images dynamically, which allows developers to:
- create charts and graphs online
- display graphics in online games
- display text as an image with various image effects such as drop shadow
- generate images on the fly
As a good example of the <canvas> tag, the site logo in the upper left corner of this page is text drawn on a canvas, not an image displayed with the <img> tag. Here is another example of the <canvas> tag.
This is an actual working demo of the code <canvas> example code below. (Do View Source to verify that this page is using the HTML 5 DOCTYPE. You can also verify it is Valid HTML 5 using the HTML Validator. Try using it to validate URLs with HTML examples from other places that claim to be HTML 5 web sites!)
Another way to create a glow gradient on an object is shown in the SVG demo.