SVG and Canvas
canvas
element works like a
div
. width
and height
attributes. getContext
to get the context on which to draw.<div> <script type="text/javascript"> function draw(){ var canvas = document.getElementById('tutorial'); if (canvas.getContext){ var ctx = canvas.getContext('2d'); } } </script> <canvas style="border: 1px solid black" id="tutorial" width="150" height="150"></canvas> </div>
2 of 24