HTML5 Canvas
HTML
What is HTML5 <canvas>?
The <canvas> element in HTML5 is used to draw graphics on the fly via JavaScript.
It’s like a blank area on your page where you can draw lines, shapes, images, charts, animations, and more.
- It only defines a drawing area. It does not draw anything by itself.
 - To draw on it, you use JavaScript.
 
Example: Drawing a Rectangle
getContext("2d"): gets a 2D rendering context to draw shapes, lines, images etc.fillStyle: sets the color to fill.fillRect(x, y, width, height): draws a filled rectangle.