liveBook · Manning

Canvas element

As explained in Vanilla Web

Canvas is an HTML element and browser graphics interface that provides a drawable surface for script-generated visual content.

The canvas element reserves part or all of an HTML document for visuals rendered by JavaScript or WebAssembly through a 2D context or 3D APIs such as WebGL. section 3.8.1 section 3.1

Choose canvas for games, multimedia, or immersive experiences—not by default for content-based interfaces. It can also complement HTML and CSS for specific graphics, such as charts. Keep text and form controls in HTML and CSS unless you have a reason to accept the accessibility, usability, and discoverability challenges of rendering them on canvas. section 3.1 section 3.8.1

How Vanilla Web covers it

How deep it goes
Defines the HTML surface and rendering contexts, but defers 2D and 3D implementation details.
Examples
Uses canvas for charts or graphics in mixed interfaces and for game, multimedia, or immersive UI.
What you can do after
Evaluate when canvas suits an interface and keep text and form controls in HTML and CSS unless their canvas rendering is justified.
How it connects
Pairs with HTML and CSS interfaces, JavaScript or WebAssembly rendering, and APIs such as WebGL.

Also explained in

Compare how 6 books explain canvas element →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vanilla Web. The section links point to the parts of the book it draws on.