How to use the select tag in html

高洛峰
Release: 2017-03-24 11:47:43
Original
2064 people have browsed it

1. Drop-down radio selection

<select>
     <option value="=1">上海</option>
     <option value="=2" selected="selected">北京</option>
     <option value="=3">广州</option>
</select>
Copy after login

How to use the select tag in html

2. Show all options

There are two types here. You can only choose one option. Multiple selection

 <select size="3">
       <option>上海</option>
       <option>广州</option>
       <option>深圳</option>
 </select>
  
 <select multiple="multiple" size="3">
       <option>上海</option>
       <option>广州</option>
       <option>深圳</option>
 </select>
Copy after login

How to use the select tag in html

3. Element classification

<select>
      <optgroup label="河北省">
          <option>石家庄</option>
          <option>邯郸</option>
          <option>枣阳</option>
      </optgroup>
      <optgroup label="湖北省">
          <option>武汉</option>
          <option>咸宁</option>
          <option>赤壁</option>
      </optgroup>
      <optgroup label="河南省">
          <option>郑州</option>
          <option>安阳</option>
          <option>驻马店</option>
      </optgroup>
</select>
Copy after login

How to use the select tag in html

The above is the detailed content of How to use the select tag in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template