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:  



Previous Article
Next Article

Similar Reads

HTML width/height Attribute vs CSS width/height Property
In HTML 5, few elements follow the width and height attributes and maximum elements do not follow this attribute. Like img, iframe, canvas, and svg kind of elements follow the width and height attributes but div, span, article and section type of elements don't follow them.The width and height attributes are affected in img, svg tags, those are wea
3 min read
HTML | &lt;img&gt; height Attribute
The &lt;img&gt; height attribute is used to specify the height of the image in pixels. Syntax: &lt;img height="pixels"&gt; Attribute Values: It contains single value pixels which specify the height of the image in pixel. Example: C/C++ Code &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head&amp;gt; &amp;lt;title&amp;gt; HTML img height
1 min read
HTML &lt;canvas&gt; height Attribute
The HTML &lt;canvas&gt; height Attribute is used to specify the height of the &lt;canvas&gt; element in terms of pixels. Syntax: &lt;canvas height="pixels"&gt; Attribute Values: It contains single value pixels which specify the height of the canvas in terms of pixel. It has a Default value which is 150. Example: This example illustrates the use of
1 min read
HTML | &lt;input&gt; height Attribute
The HTML &lt;input&gt; height Attribute is used to specify the height of the element. This Attribute is only used for input type=”image”. Syntax: &lt;input height="pixels"&gt; Attribute Values: It contains the value i.e pixels which specify the height of the input Element. Example: &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; HTML
1 min read
HTML | &lt;th&gt; height Attribute
The HTML &lt;th&gt; height Attribute is used to specify the height of the table header cell. If the &lt;th&gt; height attribute is not set then it takes default height according to content. It is not supported by HTML 5. Syntax: &lt;th height="pixels | %"&gt; Attribute Values: pixels: It sets the height of table header cell in terms of pixels. %: I
1 min read
HTML | &lt;video&gt; height Attribute
The HTML &lt;video&gt; height attribute is used to specify the height of the video player in terms of pixels. Syntax: &lt;video height="pixels"&gt; Attribute Values: It contains single value pixels which specifies the height of the video player in terms of pixels. Below example illustrates the use of height attribute in &lt;video&gt; element: Examp
1 min read
HTML | &lt;iframe&gt; height Attribute
The HTML &lt;iframe&gt; height attribute is used to specify the height of the &lt;iframe&gt; in terms of pixels. Syntax: &lt;iframe height="pixels"&gt; Attribute Values: It contains single value pixel which specifies the height of the iframes in terms of pixels. Below example illustrates the use of &lt;iframe&gt; height attribute in HTML: Example:
1 min read
HTML | &lt;object&gt; height Attribute
The HTML &lt;object&gt; height attribute is used to specify the height of the object element in terms of pixel. Syntax: &lt;object height="pixels"&gt; Attribute Values: pixels: It holds the height of the object in terms of pixels. Below example illustrates the &lt;object&gt; height attribute in HTML: Example: C/C++ Code &amp;lt;!DOCTYPE html&amp;gt
1 min read
HTML | &lt;embed&gt; height Attribute
The HTML &lt;embed&gt; height attribute is used to specify the height of the embedded content. Syntax: &lt;embed height = "pixels"&gt; Attribute Values: pixels: The width value are set in terms of pixels. It is used to specify the height of embedded content. Example: C/C++ Code &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head&amp;gt;
1 min read
HTML | Marquee height attribute
The Marquee height attribute in HTML is used to set the height of marquee in pixels or percentage value.Syntax: &lt;marquee height="px/%" &gt; Attribute value: px: Define the height value of marquee.%: Define the height value of marquee. Note : The &lt;marquee&gt; height attribute is not supported by HTML5. Example: C/C++ Code &lt;!DOCTYPE html&gt;
1 min read