``` ---"> ``` ---" />
Easy Tutorial
❮ Att A Rev Tag Basefont ❯

HTML <canvas> height Attribute

HTML <canvas> Tag

Example

A canvas (<canvas>) with a height and width of 200 pixels:

<canvas id="myCanvas" width="200" height="200" style="border:1px solid">

Browser Support

All major browsers support the height attribute.

Note: The <canvas> tag is not supported in Internet Explorer 8 and earlier versions.


Definition and Usage

The height attribute specifies the height of the <canvas> element, in pixels.

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: Learn more about <canvas> in our HTML Canvas tutorial.


Differences Between HTML 4.01 and HTML 5

<canvas> is a new tag in HTML5.


Syntax

Attribute Values

Value Description
pixels Specifies the height of the canvas in pixels (e.g., "100px" or just "100"). The default is "150".

More Examples

Clearing the Canvas


HTML <canvas> Tag

❮ Att A Rev Tag Basefont ❯