How to Use the Html5 Canvas Tag

292

4

1

Posted

Introduction: How to Use the Html5 Canvas Tag

The html5 canvas is not different from the other html canvases.Such as : <p>Text</p>. It has the same build and shape and it looks like this : <canvas> </canvas>. When using the html5 canvas tag there are a few attributes you must use like : <canvas id="canvas" width="400" height="400"></canvas>. Now to import the html5 canvas into js so you can draw shapes and text. The code looks like this :

var c = document.getElementById("canvas");
var ctx = c.getContext("2d");

Now you can learn to draw shapes in the next tutorial see you next time.

Share

    Recommendations

    • Science of Cooking

      Science of Cooking
    • Microcontroller Contest

      Microcontroller Contest
    • Spotless Contest

      Spotless Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments

    Interesting, thanks for sharing this.