HTML and CSS Reference
In-Depth Information
Getting started with <canvas>: shapes, images, and text
The
<canvas>
element is an image you can create with JavaScript. The
markup for it is similar to an
<image>
element in that you can specify a
width and a height; but it has starting and closing tags that can enclose
fallback content, and it doesn't reference an external source:
<canvas id="mycanvas" width="320" height="240"
style="outline: 1px solid #999;">
Your browser does not support the canvas element.
</canvas>
In a browser that doesn't support
<canvas>
the fallback content is dis-
played, as in this screenshot.
Canvas 2D
context
Canvas
text
4.0
4.0
You might have a static image as
the fallback if it could
adequately present some of the
information that would be
displayed in
<canvas>
In
supporting browsers. Or, if you
were particularly ambitious, you
could use an alternative
rendering method such as Flash.
2.0
3.5
9.0
9.0
9.0
10.5
3.1
4.0