HTML <canvas>
query_builder | Christopher PisaniThe <canvas> element adds a canvas to the document for drawing in the space provided. It is accessed with Javascript to draw graphics and animations. If the element canvas is not supported by the browser, a callback will be sent with text used in between the tags.
<canvas id="inCanvas" width="300" height="200" style="border:1px solid black">Your browser does not support Canvas.</canvas>
<script>
var canvas = document.getElementById('inCanvas');
var c = canvas.getContext('2d');
c.moveTo(50,50);
c.lineTo(250,150);
c.stroke();
</script>
Available Attributes
Attribute | Values | Functionality |
---|---|---|
height | value in pixels | Used for the height of the canvas |
width | value in pixels | Used for the width of the canvas |