显示多个选择中的行

时间:2016-04-06 15:20:54

标签: html css

在选择中使用多个时,您可以选择它在textarea中显示的行数吗?

现在它在使用“multiple”时只显示4个Locations作为默认值,而这个select恰好是一个短列表。有没有办法显示像6或7或所有位置而不只是默认的4行?

<select name="Location" id="loc" multiple="multiple" required>
	<!---<option selected value="">Select location</option>--->
    <option value="OPERATIONS">Operations</option>
    <option value="CCC">Contact Center</option>
    <option value="QA">QA Department</option>
    <option value="DS">DeSoto</option>
    <option value="PS">Palma Sola</option>
    <option value="LWR">Lakewood Ranch</option>
    <option value="NR">North River</option>
    <option value="SDL">SDL</option>
</select>

3 个答案:

答案 0 :(得分:1)

只需使用size属性:

 <!-- This will show 10 items of the list -->
 <select multiple size="10">


 </select>

答案 1 :(得分:0)

然后是 - 增加select框的大小。

JSfiddle

e.g。

select { 
  height:300px;
}

答案 2 :(得分:0)

你可以改变身高。

&#13;
&#13;
#loc {
  height:140px 
}
&#13;
 <select name="Location" id="loc" multiple="multiple" required>
    	<!---<option selected value="">Select location</option>--->
        <option value="OPERATIONS">Operations</option>
        <option value="CCC">Contact Center</option>
        <option value="QA">QA Department</option>
        <option value="DS">DeSoto</option>
        <option value="PS">Palma Sola</option>
        <option value="LWR">Lakewood Ranch</option>
        <option value="NR">North River</option>
        <option value="SDL">SDL</option>
    </select>
&#13;
&#13;
&#13;

编辑:同样正如gavin所说,只使用size = k属性:

&#13;
&#13;
<select size="8" name="Location" id="loc" multiple="multiple" required>
	<!---<option selected value="">Select location</option>--->
    <option value="OPERATIONS">Operations</option>
    <option value="CCC">Contact Center</option>
    <option value="QA">QA Department</option>
    <option value="DS">DeSoto</option>
    <option value="PS">Palma Sola</option>
    <option value="LWR">Lakewood Ranch</option>
    <option value="NR">North River</option>
    <option value="SDL">SDL</option>
</select>
&#13;
&#13;
&#13;