tag < canvas > :
The canvas element is used to draw graphics, on the fly, on a web page. The example at the left shows a red rectangle, a gradient rectangle, a multicolor rectangle, and some multicolor text that is drawn onto the canvas.
What is Canvas? The HTML5 canvas element is used to draw graphics, on the fly, via scripting (usually JavaScript). The canvas element is only a container for graphics. You must use a script to actually draw the graphics. Canvas has several methods for drawing paths, boxes, circles, text, and adding images.
| syntax | <canvas id = " id " > </canvas> |
|
<canvas id="MyCanvas" width="200" height="100" style="border: 1px
solid #c3c3c3;"> your browser doesnt suppourt canvas tag </canvas> <script> var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.fillStyle = "#FF0000"; ctx.fillRect(0, 0, 150, 75); </script> |