Open In App

HTML height Attribute

Last Updated : 28 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML height attribute is used to specify the height of the Element. It can be used on the following elements: 

Name

Description

<canvas>

The <canvas> element is used for drawing graphics dynamically.

<embed>

<embed> element embeds external content like multimedia within HTML documents.

<iframe>

<iframe> element embeds another webpage within an HTML document.

<img>

<img> element displays images within an HTML document.

<object> element embeds external content or plugins within HTML documents.

<input>

<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.

HTML
<!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: 

heightAttribute-(2)

HTML height Attribute Example Output

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


Next Article

Similar Reads