Description:

The HTML <canvas> tag is used for creating graphics on the fly. It can be used for rendering graphs, game graphics, or other visual images.

Any text inside the <canvas> element will be displayed in browsers that does not support <canvas>.

Example Code:
<canvas id="canvasTest">Your browser does not support the HTML5 canvas tag.</canvas>
<script type="text/javascript">
var canvas=document.getElementById('canvasTest');
var ctx=canvas.getContext('2d');
ctx.fillStyle='#800000';
ctx.fillRect(0,0,100,100);
</script>
Result:
Your browser does not support the HTML5 canvas tag.
Attributes:
Attribute Definition
height Specifies the canvas height in pixels
width Specifies the canvas width in pixels
Global Attributes:

The <canvas> tag also supports the Global Attributes in HTML5

Event Attributes:

The <canvas> tag also supports the Event Attributes in HTML5



Last updated on 2 August 2018 By Rene Spronk

View All HTML Tags

Errors? Please help to keep this list up to date, If you find any errors, please contact us, so that we can get them fixed.