The height attribute is used to specify the height of an input element, mainly for image-type inputs. It helps control the displayed size of the input image.
- Sets the height of an <input type="image"> element in pixels.
- Helps adjust the size of image buttons on a webpage.
- Used together with the width attribute for proper image dimensions.
Syntax:
<input height="pixels"> Attribute Values: It contains the value i.e pixels which specify the height of the input Element.
Example: Display an image input element with a specified height and width using the height attribute. The image is aligned centrally on the page.
<!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<head>
<title>
HTML Input Image height Attribute
</title>
</head>
<!--Driver Code Ends-->
<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>
<!--Driver Code Starts-->
</html>
<!--Driver Code Ends-->