HTML canvas height property
Examples
Height and width of 200 pixels Canvas (<canvas>):
<Canvas id = "myCanvas" width = "200" height = "200" style = "border: 1px solid" >
try it"
Browser Support
All major browsers support height attributes.
Note: Internet Explorer 8 and earlier versions of IE do not support the <canvas> tag.
Definition and Usage
Height attribute specifies the height <canvas> element, in pixels.
Tip: Whenever canvas height or width is reset, the contents of the canvas will be empty (see examples at the bottom of the page).
Tip: In our HTML Canvas learn more about <canvas> knowledge tutorial.
HTML 4.01 and HTML 5 differences between
<Canvas> tag is new in HTML5.
grammar
<canvas height="pixels">
Property Value
Value | Description |
---|---|
pixels | 规定以像素计的 canvas 高度(比如 "100px" 或仅仅是 "100")。默认是 "150"。 |
More examples
Empty Canvas
How to reset the width or height attribute to clear the canvas (using JavaScript).