HTML
Example
A canvas with a height and width of 200 pixels (
<
canvas
id
=
"
myCanvas
"
width
=
"
200
"
height
=
"
200
"
style
=
"border:1px solid
"
Try it »
Browser support

All major browsers support the height property.
Note: Internet Explorer 8 and earlier IE versions are not supported.
Definition and Usage
The height attribute specifies the
Tip: Whenever the height or width of the canvas is reset, the canvas content is cleared (see the example at the bottom of the page).
Tip: Please see ourHTML Canvas Learn more about in the tutorial
Differences between HTML 4.01 and HTML 5
Syntax
Attribute values
| Value | Description |
|---|---|
| pixels | Specifies the height of the canvas in pixels (for example, "100px" or just "100"). The default is "150". |
More examples
Clear the canvas
How to clear the canvas by resetting the width or height attribute (using JavaScript).
HTML