<canvas> Tag in html5

I am going to explain about canvas tag.
  • 2040

Definition

The canvas element gives scripts with a resolution-dependent bitmap canvas, which can be used for game graphics and other visual images on the fly.  It will draw a  square on fly and it will show inside canvas element.

Support browser in <canvas> tag.

Chrome, Firefox, Opera, Internet Explorer 9 and Safari.

Lets take an example of <Canvas> tag

<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 = '#FH0020';
        ctx.fillRect(0, 0, 60, 120);
    </script>
</body>
</html>

 


Output

Clipboard02.jpg

Further Readings

You may also want to read these related articles

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.