如何使<选项>比 选项>
但 的内容比这个长。
在IE6中是隐藏的。
如何解决这个问题?
The <select>
has a width of 60px
,
but the content of <option>
is longer than that.
Which is hidden in IE6.
How to fix that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我之前尝试过解决这个问题,但我能找到的只是 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 =
I've tried to figure this out before and all I could find were javascript hacks. I found one once upon a time that worked well but I don't know where.
You could try this:
http://brandonbuttars.com/2009/09/css-select-options-internet-explorer-cut-off/
Or plenty of other options on Google:
http://www.google.ca/search?hl=en&safe=off&q=ie6+cutoff+select+options&btnG=Search&meta=&aq=f&oq=
我们在 select 旁边添加了一个按钮,将 select 的宽度更改为默认值,因此它的宽度变得不受限制。
We added a button next to select which change select's width to default value, so it becomes non-limited in width.
简短而简单的答案:如果没有 JavaScript,这是不可能的。使用 JavaScript 解决方案,当
select
变宽时,您的布局将跳跃。有关更多信息,请参阅我对重复线程的评论。
Short and easy answer: it´s not possible without JavaScript. And with the JavaScript-solution your layout will jump when the
select
gets wider.See my comment on duplicate threads for more info.
不幸的是这是不可能的。您可以使用如下所示的自定义脚本: http://www.icant.co.uk/ forreview/tamingselect/,但它仍然是基于 JavaScript 的解决方案。
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.
我知道这是几年后的事,但它可能会帮助人们寻找解决方案。
您可以在 CSS 中通过设置聚焦时的选择宽度来完成此操作,例如
,
完整文章位于 http:// dinowebs.net/?p=114
I know this is years later but it may help someone searching for a solution.
You can do it in CSS by setting the select's width when it is in focus, e.g.
and
Full article at http://dinowebs.net/?p=114