HTML <input> heightAttributes
Examples
Define an image as a submit button, with height and width attributes:
<form action="demo_form.html">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="image" src="img_submit.gif.html" alt="Submit" width="48" height="48">
</form>
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="image" src="img_submit.gif.html" alt="Submit" width="48" height="48">
</form>
Try it yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the height attribute.
Definition and Usage
The height attribute specifies the height of the <input> element.
Note:The height attribute only applies to <input type="image">.
Tip:It is a good habit to specify the height and width attributes for images. If these attributes are set, the required space will be reserved for the image when the page loads. Without these attributes, the browser cannot know the image dimensions and therefore cannot reserve appropriate space for them. The result is that the page layout may change as the page and the image load.
Differences between HTML 4.01 and HTML5
The height attribute is a new attribute of the <input> tag in HTML5.
Syntax
<input height="pixels">
Attribute Values
| Value | Description |
|---|---|
| pixels | The height in pixels (for example, height="100"). |
HTML <input> Tag Other extensions