Open In App

HTML <input> height Attribute

Last Updated : 03 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML <input> element’s height attribute sets the height of the input field in pixels. It only applies to image inputs (<input type=”image”>). For other input types, use CSS to control the height instead.

Syntax

<input height="pixels"> 

Attribute Values

It contains the value i.e pixels which specify the height of the input Element.

Example: In this example, we display an image input element with a specified height and width using the height attribute. The image is aligned centrally on the page.

html
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML Input Image height Attribute
    </title>
</head>

<body style="text-align:center;">

    <h1 style="color:green;">
        GeeksForGeeks
    </h1>

    <h2>HTML Input image Height Attribute</h2>
    <input id="myImage" type="image" 
           src=
"https://media.geeksforgeeks.org/wp-content/uploads/gfg-40.png" alt="Submit"
           width="70" height="96" />

</body>

</html>

Output:

Supported Browsers

The browser supported by HTML <input> height Attribute are listed below:


Next Article

Similar Reads