Canvas features

Canvas is useful when JavaScript needs to draw pixels directly, but it is not a replacement for every HTML interface.

What you will learn

Good use cases

When to choose something else

Use HTML for text, forms, tables, and controls so the browser can provide semantics, keyboard behavior, and text selection. Consider SVG when shapes need to remain individually selectable or scale cleanly.

Important responsibilities

Accessibility
Canvas pixels are not automatically exposed as meaningful text. Provide a nearby explanation, labels, or an alternative interface.
Resolution
CSS scaling can make a drawing blurry. Account for device pixel ratio when sharpness matters.
Performance
Redraw only what is necessary and avoid creating excessive work in every animation frame.
Security
Cross-origin images can affect operations such as reading pixels. Understand CORS before using remote images.