HTML canvas Tag
HTML canvas Tag
The canvas tag is used to draw graphics, on the fly, via JavaScript. It is a transparent container and we have to use a script to actually draw the graphics. Text between the canvas tag will be displayed if the browser does not support the canvas element.
Attribute 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 |
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.
Syntax:-
Its syntax is:- < canvas >