HTML and CSS Reference
In-Depth Information
Figure 3-11. Dates prior to March 15, 2011 are not selectable when the min attribute is used in
Opera 11.5
3.4 Number Inputs
Problem
You want to present a user with a form in which to enter a number—for example, to
enter the quantity of an item in an order form.
Solution
Use the
input
element with the HTML5
type
value of
number
:
<form>
<p><label>Quantity <input
type="number"
name="quantity"></label></p>
<p><button type="submit">Submit</button></p>
</form>
Discussion
As you may have guessed, the
number
input type restricts the value to a valid
number—a floating-point number, to be specific.




