<canvas> element in
The canvas tag also supports the Event Attributes and Global Attributes in HTML.
Here are some frequently useful attributes for the canvas tag:
|Width||Pixels||Indicates the width of canvas with default value = 300|
|Height||Pixels||Indicates the height of canvas with default value = 150|
<canvas attribute1 attribute2> content to show what canvas displays. </canvas>
Below are some supported browsers with the versions in which they started to support the
<canvas> element for graphics/animation drawing in HTML.
The following code snippet illustrates the functionality of the
<canvas> element at line 6.
<script> tags help generate graphics with the canvas placeholder as Browser does not support the
canvx.fillStyle sets color and
canvx.fillRect sets dimensions on line 10 and line 11, respectively.
View all Courses