HTML CANVAS Tag || CANVAS Tag in HTML
×

HTML CANVAS <canvas> Tag

2007

Canvas is an HTML5 element, which is used to draw graphics for the dynamic, scriptable rendering of 2D and 3D shapes and bitmap images on the web page.

In Canvas, we need the script to draw the graphics. It provides an empty graphic zone on which specific JavaScript APIs can draw (such as Canvas 2D or WebGL).

Note:

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

Program:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>HTML Canvas Tag</title>
</head>
<body>

<h1>HTML Canvas Tag</h1>

<canvas id="myCanvasid">Your browser does not support the HTML5 Canvas Tag.</canvas>

<script>
var c = document.getElementById("myCanvasid");
var ctx = c.getContext("2d");
ctx.fillStyle = "#000";
ctx.fillRect(0, 0, 80, 100);
</script>
</body>
</html>


Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments