Css 在选择框中设置选项的宽度

Css 在选择框中设置选项的宽度,css,internet-explorer-8,Css,Internet Explorer 8,我有一个下拉列表,需要不超过100像素宽 但是,选择框中的选项需要以200px显示 有没有办法让选择框变小,选项变大 目前,选择框和选项的宽度相同 到目前为止,我已经尝试了不同的组合 select.treeItem.Destination { width:130px; } select.treeItem.Destination option {width:auto;} 我想这就是你需要的 这是一个IE6-8特有的问题,一点javascript就可以解决这个问题 <!--[if lt

我有一个下拉列表,需要不超过100像素宽

但是,选择框中的选项需要以200px显示

有没有办法让选择框变小,选项变大

目前,选择框和选项的宽度相同

到目前为止,我已经尝试了不同的组合

select.treeItem.Destination { width:130px; } 
select.treeItem.Destination option {width:auto;}

我想这就是你需要的

这是一个IE6-8特有的问题,一点javascript就可以解决这个问题

 <!--[if lt IE 9]>
 <script>
 var el;

$("select")
.each(function() {
el = $(this);
el.data("origWidth", el.outerWidth()) // IE 8 padding
})
.mouseenter(function(){
$(this).css("width", "auto");
})
.bind("blur change", function(){
el = $(this);
el.css("width", el.data("origWidth"));
});
</script>
<![endif]-->


更多关于脚本的信息可以在这里找到-

我想这就是你需要的

这是一个IE6-8特有的问题,一点javascript就可以解决这个问题

 <!--[if lt IE 9]>
 <script>
 var el;

$("select")
.each(function() {
el = $(this);
el.data("origWidth", el.outerWidth()) // IE 8 padding
})
.mouseenter(function(){
$(this).css("width", "auto");
})
.bind("blur change", function(){
el = $(this);
el.css("width", el.data("origWidth"));
});
</script>
<![endif]-->


更多关于脚本的信息可以在这里找到-

Ew,这真的不好。嗯,可能需要去一个插件我thinksEw,这真的不好。嗯,我想可能需要去一个插件