HTMLHTML16 min read

HTML Canvas

Draw graphics using canvas with JavaScript.

David Miller
December 31, 2025
0.0k0

Canvas is used to draw shapes and animations. ## Why canvas exists - charts - games - drawings ## Example ```html <canvas id="box" width="200" height="100"></canvas> <script> const c = document.getElementById("box"); const ctx = c.getContext("2d"); ctx.fillStyle = "blue"; ctx.fillRect(10,10,150,50); </script> ``` ## UI Preview A blue rectangle appears. ## Note Canvas needs JavaScript to work.

#HTML#Graphics