This Text is a dummy plz avoid this. plz focus on last line on this paragraph. Thank you Note: Always specify an id attribute (to be referred to in a script), and a width and height attribute to define the size of the canvas. To add a border, use the style attribute.
HTML Canvas Graphics This code does not work for me, anyone can solve this error.
<html>
<body>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML canvas tag.</canvas>
<script>
var c = document.getElementById("myCanva");
var ctx = c.getContext("2d");
var grd = ctx.createRadialGradient(75,50,5,90,60,100);
grd.addColorStop(0,"red");
grd.addColorStop(1,"white");
ctx.fillStyle = grd;
ctx.fillRect(10,10,150,80);
</script>
</body>
</html>
i think this is because the canvas id that you call myCanvas is not the same as your getElementById, and that has the id myCanva. i am sure this is not intentional and it works on my end if you change myCanva to myCanvas.