English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML tag大全

HTML: <input> height attribute

The input height attribute specifies the height of the <input> element, the height attribute is only applicable to <input type="image">.

 HTML <input> tag

Online Example

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

<!DOCTYPE html>
<html>
<head>
<title>HTML:<input> height 属性 - 基础教程网(oldtoolbag.com)</title>
<body>
<form action="action_page.php">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="image" src="img_submit.gif" alt="Submit" width="50" height="50">
</form>
</body>
</html>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

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:Always specify both the height and width attributes of the image. If height and width are set, the space required for the image is reserved when the page is loaded. However, if these attributes are not set, the browser will not know the size of the image and will not be able to reserve appropriate space for it. The effect is that the page layout will change during loading (when the image is loading).

HTML 4.01 and HTML5between HTML

The height attribute is a difference5 as a new attribute of the <input> tag.

Syntax

<input height="pixels">

Attribute Value

ValueDescription
pixelsHeight in pixels (for example height="100").
 HTML <input> tag