HTML <input> height attribute

Definition and usage

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

Note:height The attribute is only related to <input type="image"> Use together.

Tip:It is a good habit to specify the height and width of the image. If these attributes are set, space for the image is reserved when the page is loaded. Without these attributes, the browser cannot understand the size of the image and therefore cannot reserve appropriate space for it. In this case, the page layout changes when the page and the image are loaded.

Example

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

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

Versuchen Sie es selbst

Syntax

<input height="pixels">

Attributswert

Wert Beschreibung
pixels Legt die Höhe des <input>-Elements in Pixeln fest (z.B. height="100").

Browserunterstützung

Die Zahlen in der Tabelle geben die erste Version des Browsers an, die dieses Attribut vollständig unterstützt.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Unterstützt Unterstützt 16.0 Unterstützt Unterstützt

Anmerkung:height Das Attribut ist eine neue Eigenschaft des <input>-Tags in HTML5.