HTML <canvas> Tag
The HTML<canvas> tag supports both the global and the event attributes. HTML canvas tag belongs to Flow content, Phrasing content, Embedded content, and Palpable Content category.
The canvas tag contains two attributes which are listed below:
height: This attribute is used to set the height of the canvas.
width: This attribute is used to set the width of the canvas.
HTML<canvas> tag is supported by different types of browsers.
- Internet Explorer-9.0
<!DOCTYPE html> <html> <body> <canvas id="canvas"> HTML5 canvas tag is not supported</canvas> <script> var c = document.getElementById("canvas"); var ctx = c.getContext("2d"); ctx.fillStyle = "#FF0000"; ctx.fillRect(0, 0, 80, 100); </script> </body> </html>
Attributes that are supported by the <canvas> tag
|height||pixels||Specifies the height of the canvas|
|width||pixels||Specifies the width of the canvas|