5 回答
Unfortunately this is not possible. You could use custom scripts like this one: http://www.icant.co.uk/forreview/tamingselect/, but still - it is JavaScript based solution.
我们在选择将选择的宽度更改为默认值的旁边添加了一个按钮,因此它的宽度不受限制。
简短而简单的答案:没有 JavaScript 是不可能的。使用 JavaScript 解决方案,您的布局将在变宽时跳跃。select
有关更多信息,请参阅我对重复线程的评论。
我之前尝试过解决这个问题,但我能找到的只是 javascript hacks。从前我找到了一个效果很好但我不知道在哪里。
你可以试试这个: http ://brandonbuttars.com/2009/09/css-select-options-internet-explorer-cut-off/
或者 Google 上的许多其他选项: http ://www.google.ca/search?hl=en&safe=off&q=ie6+cutoff+select+options&btnG=Search&meta=&aq=f&oq=
我知道这是几年后的事,但它可能会帮助寻找解决方案的人。
您可以在 CSS 中通过设置焦点时选择的宽度来实现,例如
select {
width: 100px; /* normal state */
}
和
select:focus {
width: 200px; /* wider when in focus */
}