HTML | <canvas> height Attribute
The HTML <canvas> height Attribute is used to specify the height of the <canvas> element in terms of pixels.
Syntax:
<canvas height="pixels">
Attribute Values: It contains single value pixels which specify the height of the canvas in terms of pixel. It has a Default value which is 150.
Example: This example illustrates the use of height attribute in Canvas Element.
<!-- HTML code to illustrate height attribute of canvas tag --><!DOCTYPE html> <html> <head> <title>HTML canvas height attribute</title> </head> <body style="text-align:center;"> <h1>GeeksForGeeks</h1> <h2>HTML Canvas Height Attribute</h2> <canvas id="geeks" height="200" width="200" style="border:1px solid black"> </canvas> <script> var c = document.getElementById("geeks"); var cx = c.getContext("2d"); cx.beginPath(); cx.arc(100, 100, 90, 0, 2 * Math.PI); cx.stroke(); </script> </body> </html> |
Output:

Supported Browsers: The browser supported by HTML <canvas> height Attribute are listed below:
- Google Chrome 4.0
- Internet Explorer 9.0
- Firefox 2.0
- Safari 3.1
- Opera 9.0
Recommended Posts:
- HTML | <td> height Attribute
- HTML | <img> height Attribute
- HTML | height Attribute
- HTML | <th> height Attribute
- HTML | <video> height Attribute
- HTML | <video> height Attribute
- HTML | <input> height Attribute
- HTML | Marquee height attribute
- HTML | <iframe> height Attribute
- HTML | <embed> height Attribute
- HTML | <object> height Attribute
- HTML | DOM Video height Property
- HTML | DOM embed height property
- HTML | DOM Style height Property
- HTML | DOM IFrame height Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



