Skip to content
EntityQ657954· pop 25· linked from 188 articles

Also known as <canvas>, canvas element, HTML canvas, HTML5 canvas

HTML element

In the Vinony graph

Within Vinony's link graph, canvas is referenced by 188 other articles, and connects out to SVG, client-server model and Web Hypertext Application Technology Working Group.

Vinony files it under HTML5 and HTML tags.

Its subject is documented across 23 Wikipedia language editions.

Described at

Transparent , but with no interactive content descendants except for a elements, img elements with usemap attributes, button elements, input elements whose type attribute are in the Checkbox) or Radio Button) states, input elements that are buttons , and select elements with a multiple attribute or a display size greater than 1. The canvas element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, art, or other visual images on the fly. When authors use the canvas element, they must also provide content that, when presented to the user, conveys essentially the same function or purpose as the canvas 's bitmap. This content may be placed as content of the canvas element. The contents of the canvas element, if any, are the element's fallback content . In interactive visual media, if scripting is enabled for the canvas element, and if support for canvas elements has been enabled, then the canvas element represents embedded content consisting of a dynamically created image, the element's bitmap. In non-interactive, static, visual media, if the canvas element has been previously associated with a rendering context (e.g. if the page was viewed in an interactive visual medium and is now being printed, or if some script that ran during the page layout process painted on the element), then the canvas element represents embedded content with the element's current bitmap and size. Otherwise, the element represents its fallback content instead. In non-visual media, and in visual media if scripting is disabled for the canvas element or if support for canvas elements has been disabled, the canvas element represents its fallback content instead. An element whose nearest canvas element ancestor is being rendered and represents embedded content is an element that is being used as relevant canvas fallback content. The canvas element has two attributes to control the size of the element's bitmap: width and height . These attributes, when specified, must have values that are valid non-negative integers . The rules for parsing non-negative integers must be used to obtain their numeric values. If an attribute is missing, or if parsing its value returns an error, then the default value must be used instead. The width attribute defaults to 300, and the height attribute defaults to 150. The natural dimensions of the canvas element when it represents embedded content are equal to the dimensions of the element's bitmap. The user agent must use a square pixel density consisting of one pixel of image data per coordinate space unit for the bitmaps of a canvas and its rendering contexts. When its canvas context mode is none , a canvas element has no rendering context, and its bitmap must be transparent black with a natural width equal to the numeric value of the element's width attribute and a natural height equal to the numeric value of the element's height attribute, those values being interpreted in CSS pixels , and being updated as the attributes are set, changed, or removed. When a canvas element represents embedded content , it provides a paint source whose width is the element's natural width , whose height is the element's natural height , and whose appearance is the element's bitmap. 2. Perform the action from the row of the following table that corresponds to element's context mode . 2d Follow the steps to set bitmap dimensions to the numeric values of element's width and height content attributes. webgl or webgl2 Follow the behavior defined in the WebGL specifications. [[WEBGL]]( webgpu Follow the behavior defined in WebGPU. [[WEBGPU]]( bitmaprenderer If the context's bitmap mode is set to blank , run the steps to set an ImageBitmapRenderingContext 's output bitmap , passing element's rendering context. placeholder Do nothing. none Do nothing. These steps also run when the width or height content attribute is set to the value it already has. The width and height IDL att

Excerpt from a page describing this subject · 40,000 chars · not written by Vinony

Wikidata facts

Show 3 more facts
Sources (4)

via Wikidata · CC0

Categories