html5<canvas> tag


  Translation results:

canvas

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

n. Canvas; oil painting (cloth)

vt. Cover with canvas

adj.Canvas

html5<canvas> tagsyntax

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> tagexample


<!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

Popular Recommendations

Home

Videos

Q&A