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

HTML Reference Manual

Complete List of HTML Tags

HTML: <input> step attribute

The input step attribute specifies the interval between valid numbers in the <input> element, if step = '3', then valid numbers can be -3, 0, 3, 6, etc., and the step attribute can be used with the max and min attributes to create a range of valid values.

 HTML <input> etichetta

Online Example

An HTML form with input fields that have specified valid numeric intervals:

<!DOCTYPE html>
<html>
<head>
<title>HTML: <input> step attribute - Basic Tutorial Website (oldtoolbag.com)</title>
<body>
<form action="action_page.php">
  <input type="number" name="points" step="3">
  <input type="submit">
</form>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Internet Explorer 10, Opera, Chrome e Safari supportano l'attributo step.

Attenzione:Firefox o Internet Explorer 9 e versioni precedenti non supportano l'attributo step dell'etichetta <input>.

Definizione e uso

L'attributo step specifica l'intervallo tra i numeri validi dell'elemento <input>.

Ad esempio: se step =“ 3”, i numeri validi possono essere -3, 0, 3, 6 e così via.

Suggerimento:L'attributo step può essere utilizzato con max e min Attributi combinati per creare un intervallo di valori validi.

Attenzione:L'attributo step è applicabile ai seguenti tipi di input: number, range, date, datetime, datetime-local, month, time e week.

Differenze tra HTML 4.01 e HTML5

L'attributo step è una nuova attributo in HTML5.

Sintassi

<input step="number">

Valore dell'attributo

ValoreDescrizione
numberDefinire l'intervento numerico legittimo del campo di input.
 HTML <input> etichetta