”;
Canvas element is the outline of the HTML Canvas tag which is defined by the HTML code and is styled using the CSS. We can render graphics inside the canvas using JavaScript code by a context object.
Canvas element is equipped with the interface HTMLCanvasElement containing properties and methods to manipulate the layout as well as the features supported by the Canvas element.
The properties and methods available to create and modify the Canvas element are given in the below table.
Properties
Following are various properties of HTML Canvas Element −
S.No | Property and Description |
---|---|
1 | Canvas
The canvas property of CanvasRenderingContext2D interface provides the canvas outline by using CSS styling. Without styling, we cannot see it on the webpage even though it is formed. |
2 | Width
This property helps us to set the width for the Canvas layout. |
3 | Height
This property helps us to set the height for the Canvas layout. |
Methods
Below given is the list of methods provided by the HTML Canvas Element class −
S.No | Method & Description |
---|---|
1 | getContext()
This method refers to the context of the drawing on the Canvas element. We give the context type and attributes as the parameters which are displayed on the Canvas. |
”;