How to Use the Html5 Canvas Tag

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.

Be the First to Share

    Recommendations

    • Mason Jar Speed Challenge

      Mason Jar Speed Challenge
    • Bikes Challenge

      Bikes Challenge
    • Remix Contest

      Remix Contest

    Discussions