jump

HTML 5: The Markup Language (ARIA Edition)

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.
aria = #
(detailed attribute description to come)

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(optional DOMString type, any... args);
  void toBlob(FileCallback? _callback, optional DOMString type, any... args);

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