HTML - 更改多个选择标签上的最大行数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15768972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML - Change maximum rows on a select tag multiple
提问by Mich'
So how can I change how many rows a select tag with multiple enabled should be showed:
那么如何更改启用多个选项的选择标记应显示的行数:
<select multiple="multiple">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
This will only show the first four options how can I show the fifth without have to scroll?
这将只显示前四个选项如何显示第五个而不必滚动?
采纳答案by darwin
You can use CSS to specify the exact height, but this will probably not render exactly the same across all browsers due to different rendering of the select:
您可以使用 CSS 来指定确切的高度,但由于选择的呈现不同,这可能不会在所有浏览器中呈现完全相同的高度:
<select multiple="multiple" style="height: 24pt">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
Fiddle: http://jsfiddle.net/24Myw/
回答by David says reinstate Monica
Use the size
attribute:
使用size
属性:
<select size="5" multiple name="whatever">
References:
参考:
回答by Eng Maisa
<select size="any number" name="#" id="#">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
it working well
它运作良好
回答by Ravi Joon
we can also use attribute "Row
" for ASPX pages, use code below
我们也可以Row
为 ASPX 页面使用属性“ ”,使用下面的代码
<asp:ListBox runat="server" SelectionMode="Multiple" Rows="10"></asp:ListBox>