elibraryportal Logo

HTML Canvas

The HTML <canvas> element is a rectangle like area on an HTML page used to draw graphics on a web page.

  • It shows four elements:
    1. A red rectangle
    2. A gradient rectangle
    3. A multicolor rectangle
    4. A multicolor text.

What is HTML Canvas?

The canvas is only a container for graphics. You must use JavaScript to actually draw the graphics. It is easy and powerful way to draw graphics

Syntax:-

Example:-

Test it Now
Next TopicHTML SVG