HTML Intro

HTML Intro Quiz

HTML Intro Exercise

HTML Basics

HTML Basic Quiz

HTML Basic Exercise

HTML Advance

HTML Advance Quiz

HTML Advance Exercise

HTML Tags List

HTML Global Attributes

HTML Attributes


HTML5 Canvas Element

Canvas Tag



The HTML canvas is used to draw graphics that include everything from simple lines to complex graphic objects. It must have an id attribute so that it can be referred to by javascript. getContext() returns a drawing context on the canvas. Text between the canvas tag will be displayed if the browser does not support the canvas element.


Canvas Coordinates:-


The HTML canvas is a two-dimensional grid. The upper-left corner of the canvas has the coordinates (0,0).

  • X coordinate increases to the right.
  • Y coordinate increases toward the bottom of the canvas.


Attributes explanation:-


Attribute Value Description
height pixels Specifies the height of the canvas. The default value is 150
width pixels Specifies the width of the canvas Default value is 300




Its syntax is:- < canvas >

Code Explanation

All Tutorials related to HTML Advance

All Sections related to HTML