The form control select tag is used to create a drop-down list. The tag is used to define the available options and other attributes to set the selection characteristics of the form control. Count etc.
What I will introduce today is the usage of form control select in HTML. It has certain reference value and I hope it will be helpful to everyone.
【Recommended course: HTML tutorial 】
##select tag
select is used to create drop-down lists and can be used to accept user input in forms. The
tag in its element is mainly used to define the available options in the list.
Example: through select Implementation of drop-down menu case
<select style="width:100px;height:30px;">
<option>打球</option>
<option>运动</option>
<option>看电视</option>
</select> Copy after login
The rendering is as follows:
select attributes:
select has the following three new attributes in HTML5:
autofocus: refers to the text area will be changed after the page is loaded. Automatically obtain focus. Note that Internet Explorer 9 and earlier versions do not support the autofocus attribute of the tag.
form: Indicates one or more forms to which the text area belongs. Note that Internet Explorer does not support the form attribute.
required: refers to the range of the text area and this attribute is required. This attribute is currently not supported by all mainstream browsers.
size: refers to the number of visible options in the drop-down list.
disabled: Indicates that the use of the drop-down list is prohibited.
multiple: Indicates that multiple options can be selected.
name: refers to the name of the drop-down list.
Example: Set the visible bibliography of the drop-down list to 2 and you can select multiple options
<select style="width:100px;height:40px;" multiple="multiple" size="2">
<option>打球</option>
<option>运动</option>
<option>看电视</option>
</select> Copy after login
The rendering is as follows:
Summary: The above is the entire content of this article. I hope that through this article, everyone can understand and use the select tag.
The above is the detailed content of How to use the form control select tag. For more information, please follow other related articles on the PHP Chinese website!