canvas

UK[ˈkænvəs] US[ˈkænvəs]

n. Canvas; oil painting (cloth)

vt. Cover with canvas

adj.Canvas

html5<canvas> tag syntax

Function: The <canvas> tag defines graphics, such as charts and other images. The <canvas> tag is just a container for graphics, you must use a script to draw the graphics.

Parameters:

Attributes
ValueDescription
heightpixelsSet the height of canvas.
widthpixelsSet the width of the canvas.

html5<canvas> tag example


<!DOCTYPE HTML>
<html>
<body>

<canvas id="myCanvas">your browser does not support the canvas tag </canvas>

<script type="text/javascript">

var canvas=document.getElementById('myCanvas');
var ctx=canvas.getContext('2d');
ctx.fillStyle='#FF0000';
ctx.fillRect(0,0,80,100);

</script>

</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance