Skip to content
Related Articles

Related Articles

HTML | <canvas> height Attribute

Improve Article
Save Article
  • Last Updated : 15 Jul, 2022
Improve Article
Save Article

The HTML <canvas> height Attribute is used to specify the height of the <canvas> element in terms of pixels


<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>
    <title>HTML canvas height attribute</title>
<body style="text-align:center;">
    <h2>HTML Canvas Height Attribute</h2>
    <canvas id="geeks"
            style="border:1px solid black">
        var c = document.getElementById("geeks");
        var cx = c.getContext("2d");
        cx.arc(100, 100, 90, 0, 2 * Math.PI);



Supported Browsers: The browser supported by HTML <canvas> height Attribute are listed below:

  • Google Chrome 1.0 and above
  • Edge 12.0 and above
  • Internet Explorer 9.0 and above
  • Firefox 1.5 and above
  • Safari 3.0 and above
  • Opera 9.0 and above
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!