codescracker


html

HTML Canvas



« Previous Tutorial Next Tutorial »


The CANVAS tag of HTML is introduced in HTML5, used to display 2D shapes and graphics on the Web page. This tag allows you to use graphs, games, and other visuals in the Web page.

You can also use the CANVAS tag to apply various transformations, such as rotate and blur on an image. The content that is defined between the starting and the ending tags of the CANVAS tag is only displayed when the Web browser does not support the tag.

The attributes of the CANVAS tag are height and width, which specify the height and width of the canvas.

HTML CANVAS Example

The following HTML code snippet shows an example of using the CANVAS tag :

<CANVAS id="canvas" width="50" height="100">
</CANVAS>

As shown in the above code snippet, we have also defined another attribute of the CANVAS tag that is the id attribute, which is used to specify a unique name to the tag. The id attribute of the CANVAS tag is used with the JavaScript code to display graphics on the Web page.


« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test