Follow the Example
Example:
HTML
<canvas id="myCanvas">
Your browser does not support the canvas tag.
</canvas>
<script>
let c = document.getElementById("myCanvas");
let ctx = c.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(20, 20, 75, 50);
//Turn transparency on
ctx.globalAlpha = 0.2;
ctx.fillStyle = "blue";
ctx.fillRect(50, 50, 75, 50);
ctx.fillStyle = "green";
ctx.fillRect(80, 80, 75, 50);
</script>
How to create HTML <canvas> Tag | HTML Tag |
Tips and Notes for HTML <canvas> Tag | HTML Tag |
What Type of Browsers will Support for HTML <canvas> Tag | HTML Tag |
Attributes for HTML <canvas> Tag | HTML Tag |
Another <canvas> example | HTML Tag |
Default CSS Settings For HTML <canvas> Tag | HTML Tag |
How to add HTML <canvas> height Attribute | HTML Tag |
How to add HTML <canvas> width Attribute | HTML Tag |
How to Clear the canvas by setting the width attribute to 400px (using JavaScript) | HTML Tag |
Type: | Html |
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded by: | Admin |