May 03, 2021 HTML5
You should have understood the HTML form input types in this web site's HTML tutorial, and in this section, we'll cover some of the new form types in HTML5!
HTML5 has several new form input types. These new features provide better input control and validation.
This chapter provides a comprehensive overview of these new input types:
Note: Not all major browsers support new input types, but you can already use them in all major browsers. Even if not supported, it can still appear as a regular text field.
The color type used in the input field is primarily used to select colors, as follows:
Select a color from the color picker:
The date type allows you to select a date from a date selector.
The datetime type allows you to select a date (UTC time).
Define a date and time controller (local time):
The datetime-local type allows you to select a date and time (no time zone).
Define a date and time (no time zone):
The e-mail type is used for input fields that should contain e-mail addresses.
When you submit a form, the value of the email field is automatically verified to be valid:
Tip: Safari in your iPhone supports email input types and works with it by changing the touch-screen keyboard (add the options for .com and you).
The month type allows you to select a month.
Define month and year (no time zone):
The number type is used for input fields that should contain values.
You can also set a limit on the numbers you accept:
Define a numeric input field (qualified):
Use the following properties to define the limit for the type of number:
Try an example with all the qualified properties Try
The range type is used for input fields that should contain a range of numeric values.
The range type appears as a slider.
Define a value that does not require very precision (similar to slider control):
Use the following properties to define the limit for the type of number:
The search type is used for search domains, such as site search or Google search.
Define a search field (similar to site search or Google search):
The time type allows you to select a time.
Define an inputable time controller (no time zone):
The url type is used for input fields that should contain URL addresses.
When you submit a form, the value of the url field is automatically verified.
Tip: Safari in your iPhone supports url input types and works with it by changing the touchscreen keyboard (add .com options).
The week type allows you to select weeks and years.
Label | describe |
---|---|
<input> | Describe the Input input |
Input talk: HTML5's Input type