Drawing elements
In previous versions of HTML, if you wanted a graphic or image, you had to create it in another application and use the img
element to pull it into your document. HTML5 has brought some new elements and features to replace the old elements that allow you to draw your own images in the browser.
canvas
The syntax of the canvas
element is as follows:
<canvas height width></canvas>
Attributes
The attributes that are used in the canvas
element are as follows:
height
: This is an attribute to set the heightwidth
: This is an attribute to set the width
Description
The canvas
element is used for drawing. You can use JavaScript to draw lines, shapes, and images; pull frames from videos; and use WebGL, to name just a few features. The HTML element ...
Get Web Developer's Reference Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.