HTML <input> size Atribut

❮ HTML tag <input>

Příklad

HTML formulář se dvěma vstupními poli o šířce 50 a 4 znacích:

<form action="/action_page.php">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname" size="50"><br><br>
  <label for="pin">PIN:</label>
  <input type="text" id="pin" name="pin" maxlength="4" size="4"><br><br>
  <input type="submit" value="Submit">
</form>

Definice a použití

Atribut sizeurčuje viditelnou šířku <input>prvku ve znacích.

Poznámka: Atribut sizefunguje s následujícími typy vstupu: text, hledání, tel, url, e-mail a heslo.

Tip: Chcete-li zadat maximální povolený počet znaků v <input>prvku, použijte maxlengthatribut.


Podpora prohlížeče

Čísla v tabulce určují první verzi prohlížeče, která tento atribut plně podporuje.

Attribute
size Yes Yes Yes Yes Yes

Syntax

<input size="number">

Hodnoty atributů

Value Description
number Specifies the width of an <input> element, in characters. Default value is 20

❮ HTML tag <input>