For more articles on canvas, see the canvas topic page.
- Content categories Flow content, phrasing content, embedded content, palpable content.
- Permitted content Transparent but with no interactive content descendants except for
- Tag omission None, both the starting and ending tag are mandatory.
- Permitted parent elements Any element that accepts phrasing_content.
- DOM interface
This element includes the global attributes.
- The width of the coordinate space in CSS pixels. Defaults to 300.
- The height of the coordinate space in CSS pixels. Defaults to 150.
Note: The displayed size of the canvas can be changed using a stylesheet. The image is scaled during rendering to fit the styled size.
<canvas id="canvas" width="300" height="300"> Sorry, your browser doesn't support the <canvas> element. </canvas>
|WHATWG HTML Living Standard||Living Standard|
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari|
|Basic support||1.0||1.5 (1.8)||9.0||9.0||2.0|
|Feature||Firefox Mobile (Gecko)||Android||IE Mobile||Opera Mobile||Safari Mobile|
|Basic support||1.0 (1.8)||?||?||?||1.0|
- Before Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2), the canvas width and height were signed integers instead of unsigned integers.
- Prior to Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3), a
<canvas>element with a zero width or height would be rendered as if it had default dimensions.
<canvas>element was being rendered instead of showing the fallback content as per the specification. Now the fallback content is rendered instead.