在下拉框中调整列表的高度 [英] adjust the height of the list in dropdown box
问题描述
可能存在重复:
编辑:
以上代码将使选择看起来像列表框。您无法控制选择对象的大小,仍然保持它看起来一样。因为它是一个应用程序级别控件,所以Web浏览器呈现它并且不允许此设置。有关更多信息,请参阅以下堆栈溢出页面,其中有相同的问题:
HTML选择框高度(下拉菜单)Possible Duplicate:
height of the dropdown box displayhi
how can I adjust the height of the list in the dropdown because I have too many values loaded in the drop down box. For example, it only show 10 entries, and with scrollbars to see remaining. does anyone know how to do that?
this not what I want
I want this ,which only display 5 option and with scrollbars to see remaining
解决方案Use the following code:
<select size="10" id="items"> <option value="a1">A1</option> <option value="b1">B1</option> <option value="c1">C1</option> <option value="d1">D1</option> <option value="e1">E1</option> <option value="a2">A2</option> <option value="b2">B2</option> <option value="c2">C2</option> <option value="d2">D2</option> <option value="e2">E2</option> </select>
Where
10
is the number of items to show at one time. Be sure to be considerate of people with small resolutions who may not be able to see all of the items if you make it too large. Please consult the following link for more information about this setting:http://www.w3schools.com/tags/att_select_size.asp
EDIT:
The above code will make the select look like a list box. You cannot control the size of the select object and still keep it looking the same. Because it is an application level control, the web browser renders it and does not allow for this setting. For more information, see the following Stack Overflow page that features the same question:
Height of an HTML select box (dropdown)
这篇关于在下拉框中调整列表的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!