HTML5 input types
Choosing the right input type does more than only validate the input and provide native error messages, it also will change the keyboard input for mobile devices. If there is an input type that matches your requirements, that often is all that is needed.
HTML5 Input Types
Depending on the type, other attributes can be added to the input element to further constrain the allowed value.
Input Type Attributes