HTMLInputElement: height property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Theheight property of theHTMLInputElement interface specifies the height of a control. It reflects the<input> element'sheight attribute.
Theheight property is valid for theimage type only. It defines the vertical dimension of the image button, in pixels. If CSS sizing properties apply to the control, the value is the height of the content box of the rendered control, not the value of theheight attribute. If noheight is set and CSS does not impact the control's size, theheight will be the intrinsic height of the image. If the image didn't load, the value will be the height of thealt text. Theheight will be0 if the height is not known; if noheight is set, CSS doesn't impact the height, the image didn't load, and either the value of thealt is the empty string or nosrc is set.
In this article
Value
A number.
Examples
const inputElement = document.getElementById("imageButton");console.log(inputElement.height);Specifications
| Specification |
|---|
| HTML> # dom-input-height> |
Browser compatibility
See also
HTMLInputElement.widthHTMLInputElement.srcHTMLInputElement.altHTMLButtonElement<button><input><img>- CSS
inline-sizeproperty - CSS
heightproperty - CSS
aspect-ratioproperty - CSS box sizing module