The HTML height attribute is used to specify the height of the Element. It can be used on the following elements:
Name | Description |
|---|---|
The <canvas> element is used for drawing graphics dynamically. | |
<embed> element embeds external content like multimedia within HTML documents. | |
<iframe> element embeds another webpage within an HTML document. | |
<img> element displays images within an HTML document. | |
<object> element embeds external content or plugins within HTML documents. | |
<input> element allows user input within forms in HTML documents. |
Syntax
<element height="value" >
Example 1: In this example we the HTML height attribute sets the height of a canvas element, defining its vertical dimension, often used for rendering graphics or animations.
<!DOCTYPE html>
<html>
<head>
<title>HTML height Attribute</title>
</head>
<body>
<h2>HTML height Attribute</h2>
<!-- canvas Tag starts here -->
<canvas id="GeeksforGeeks"
width="200"
height="100"
style="border: 1px solid black">
</canvas>
<!-- canvas Tag ends here -->
</body>
</html>
Output:
.png)
Supported Browsers: The browser supported by HTML height Attribute are listed below:

