jump

HTML: The Markup Language Reference

canvascanvas for dynamic graphics NEW # T

The canvas element represents a resolution-dependent bitmap canvas, which can be used for dynamically rendering of images such as game graphics, graphs, or other images.

Permitted contents #

Permitted attributes #

global attributes
Any attributes permitted globally.
height = non-negative integer #
The height of the canvas, in CSS pixels.
width = non-negative integer #
The width of the canvas, in CSS pixels.

Tag omission #

A canvas element must have both a start tag and an end tag.

Permitted parent elements #

any element that can contain phrasing elements, any element that can contain flow elements

DOM interface #

interface HTMLCanvasElement : HTMLElement {
           attribute unsigned long width;
           attribute unsigned long height;

  DOMString toDataURL(in optional DOMString type, in any... args);

  object getContext(in DOMString contextId, in any... args);
};