Html 如何从选择下拉列表中删除滚动条
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6301459/
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
How to remove the scroll bar from the select dropdown list
提问by moredesires
I would like to know how to remove the scroll bar from the selectdropdown list? I have also tried overflow: hidden;
but it doesn't work in Firefox.
我想知道如何从选择下拉列表中删除滚动条?我也试过,overflow: hidden;
但它在 Firefox 中不起作用。
CSS:
CSS:
.search_pulldown_txtbox1
{
height:120px;
overflow:hidden;
width: 160px;
margin-top:8px;
background-image:none;
margin-left:10px;
line-height: 14px;
}
HTML:
HTML:
<select name="keyword_select" multiple="multiple" class="search_pulldown_txtbox">
<option> 1</option>
<option> 2</option>
<option> 3</option>
</select>
回答by David Tang
<select>
s are notoriously difficult to style. Each browser renders them differently. If you really must control the look and feel of a <select>
, then you may have to resort to custom components built from other HTML elements. E.g. this one.
<select>
s 是出了名的难以设计风格。每个浏览器以不同的方式呈现它们。如果您真的必须控制 a 的外观和感觉<select>
,那么您可能不得不求助于从其他 HTML 元素构建的自定义组件。例如这个。