HTML <input> height attribute

Definition and Usage

height The attribute specifies the height of the <input> element.

Note:height The attribute only applies to <input type="image"> Used together.

Tip:It is a good practice to specify the height and width of an image. If these properties are set, the required space for the image will be reserved when the page is loaded. If not, the browser cannot determine the size of the image and therefore cannot reserve an appropriate space. The situation is that when the page and the image are loaded, the page layout will change.

Example

Define the image as a submit button with height and width attributes:

<form action="/action_page.php">
  <label for="fname">Name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last Name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="image" src="img_submit.gif" alt="Submit" width="48" height="48">
</form>

Try It Yourself

Syntax

<input height="pixels">

Attribute Value

Value Description
pixels Specifies the height of the <input> element in pixels (for example, height="100").

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support 16.0 Support Support

Note:height The attribute is a new attribute of the <input> tag in HTML5.