HTML-in-Canvas ships: could it make the web more creative—or stupider?

HTML enters the canvas
The canvas element, developed by Apple and standardized in 2014, gives JavaScript a space to draw graphics. It can render shapes, text and images, while WebGL or WebGPU can use it for 3D visuals and other effects.
HTML-in-Canvas lets JavaScript place HTML commands inside that space. When a canvas has the “drawable” content attribute, the browser prepares its HTML content for JavaScript to render.
Interactive ideas take shape
Developers can attach HTML controls to 3D objects. One example lets users turn pages in a virtual book and copy its text; another places a video and its controls inside an unusually shaped canvas.
The API also works with JavaScript tools including Three.js and D3.js, supporting 3D environments and charts. Developer Wes Bos put a notes app in a canvas and layered Duck Hunt-style game code over it.
Demos show the possibilities
A demo at html-in-canvas.dev shows a dragon moving through the opening chapter of an online book, with the text reflowing around it. The creature can also burn the virtual text when users try to shoo it away with a cursor. Another example creates a mouse-driven elastic displacement effect, with a radial bulge and drop shadow following the cursor.
Bugs and standards work remain
The API still has bugs and has not yet become cross-platform. In some cases, CSS appears in the wrong place, while timing with reactive frameworks needs better synchronization.
Developers resolved a problem involving canvas copying sensitive cross-origin data contrary to CORS rules. However, the API does not say when it refuses to copy that data, leaving users to report what look like silent failures.
Key points
- HTML-in-Canvas shipped with Chrome 157 after two years of experimentation.
- The API lets JavaScript render HTML content inside a canvas.
- Examples include interactive books, videos, 3D environments and charts.
- The API has bugs, is not cross-platform, and has been submitted to the WHATWG HTML Living Standard.

