", According to different type attribute values, the input field has various forms."/> ", According to different type attribute values, the input field has various forms.">
Home > Article > Web Front-end > Is input a paired tag in HTML5?
The input in HTML5 is not a paired tag, it is a single tag with only a start tag and no end tag; the input tag is used to specify the input field where the user can enter data, the syntax "", according to different type attribute values, the input field has various forms.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
In HTML, tags are keywords surrounded by angle brackets, usually appearing in pairs such as <div> and <code>
There are also tags presented separately, such as: <img src="1.jpg" alt="Is input a paired tag in HTML5?" >
, etc. This type of tag is called "single tag".
So are input tags in pairs in HTML5?
Input is not a paired tag, but a single tag, with only a start tag and no end tag.
Syntax:
<input type="类型值" />
According to different type attributes, input fields have multiple forms. Input fields can be text fields, checkboxes, password fields, radio buttons, buttons, etc.
Type attribute value | Description |
---|---|
button | Define the clickable button (Often used with JavaScript to launch a script). |
checkbox | Define the checkbox. |
color | Define the color picker. |
date | Define date control (including year, month, day, excluding time). |
datetime | Define date and time controls (including year, month, day, hour, minute, second, fraction of a second, based on UTC time zone). |
datetime-local | Define date and time controls (including year, month, day, hour, minute, second, fraction of a second, without time zone) . |
Defines the fields used for e-mail addresses. | |
file | Define the file selection field and "Browse..." button for file upload. |
hidden | Define hidden input fields. |
image | Define the image as the submit button. |
month | Define month and year controls (without time zone). |
number | Defines the field for entering numbers. |
password | Define the password field (characters in the field will be masked). |
radio |
Define radio buttons. |
#range | Defines a control for entering numbers where the exact value is not important (such as a slider control). |
reset | Define the reset button (reset all form values to default values). |
search | Define the text field used to enter the search string. |
submit | Define the submit button. |
tel | Defines the field for entering a phone number. |
text | Default. Defines a single-line text field (default width is 20 characters). |
time | Defines a control for entering time (without time zone). |
url | Defines the field for entering the URL. |
week | Define week and year controls (without time zone). |
Example:
<input type="button" value="点我">
<input type="checkbox" name="vehicle[]" value="Bike"> 我有一辆自行车<br> <input type="checkbox" name="vehicle[]" value="Car"> 我有一辆小轿车<br> <input type="checkbox" name="vehicle[]" value="Boat"> 我有一艘船<br>
选择你喜欢的颜色: <input type="color" name="favcolor"><br>
生日 (日期和时间): <input type="datetime" name="bdaytime">
Related recommendations: "html video tutorial"
The above is the detailed content of Is input a paired tag in HTML5?. For more information, please follow other related articles on the PHP Chinese website!