Canvas element
The HTML canvas element allows for dynamic, scriptable rendering of 2D shapes and bitmap images.[src] Introduced in HTML5, it is a low level, procedural model that updates a bitmap.[src] The element also helps in making 2D games.[src] While the element offers its own 2D drawing API, it also supports the WebGL API to allow 3D rendering with OpenGL ES.[src]
The HTML canvas element allows for dynamic, scriptable rendering of 2D shapes and bitmap images.[src] Introduced in HTML5, it is a low level, procedural model that updates a bitmap.[src] The element also helps in making 2D games.[src] While the element offers its own 2D drawing API, it also supports the WebGL API to allow 3D rendering with OpenGL ES.[src] This text is displayed if your browser does not support HTML canvas element.[src] Using JavaScript, you can draw on the canvas: var example = document.getElementById('example'); var context = example.getContext('2d'); context.fillStyle = 'red'; context.fillRect(30, 30, 50, 50); This code draws a red rectangle on the screen.[src] The Canvas API also provides save() and restore() , for saving and restoring all the canvas context's attributes.[src] Canvas element size: 600 x 300, Canvas drawing surface size: 300 x 150 body { background: #dddddd; } #canvas { margin: 20px; padding: 20px; background: #ffffff; border: thin inset #aaaaaa; width: 600px; height: 300px; } Canvas not supported[src]
12 sentences · 12 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Canvas element." encyclopegia.org, 2026, https://encyclopegia.org/wiki/canvas-element. Accessed 29 November 2026.
Chicago
"Canvas element." encyclopegia.org. Accessed November 29, 2026. https://encyclopegia.org/wiki/canvas-element.
APA
encyclopegia.org. (2026). Canvas element. Retrieved November 29, 2026, from https://encyclopegia.org/wiki/canvas-element
Accessed November 29, 2026 · CC BY-SA 4.0 · citation page · JSON