DiscoveryVIPAll guides ↗

HTML5 + JAVASCRIPT / FROM YOUR FIRST PIXEL

Learn to draw.
Make the web move.

A beginner path through HTML canvas: create a surface, paint shapes, animate a scene, and respond to a pointer. Change real code and see what happens.

24 lessons · Live previews · Visual shape explorer

YOUR FIRST CANVAS DRAWING
const ctx = canvas.getContext('2d');
ctx.fillStyle = '#246a73';
ctx.fillRect(40, 40, 180, 100);

HTML creates the surface.
JavaScript paints the pixels.

Start here: Basic HTML and JavaScript help; the first lessons explain the setup. Examples run in a sandboxed browser preview. External resources are blocked. Stop preview ends animations, but an infinite loop can freeze the browser thread. This is a complete beginner learning path, not an exhaustive API reference.
0 / 24knowledge checks passed

Try this experiment

Run the example to see your drawing.

Each run starts a fresh 600 × 360 canvas. Ctrl/⌘ + Enter runs your draft. Code execution is separate from the knowledge check.

Choose one answer