Open In App

HTML height Attribute

Last Updated : 08 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
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>

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



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads