控制IE8中的下拉列表宽度选择 [英] Controlling the drop down list width in IE8 on select

查看:141
本文介绍了控制IE8中的下拉列表宽度选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以控制IE8中选择的下拉列表宽度?

Is it possible to control the drop down list width on select in IE8?

当页面加载时,我希望下拉列表足够小,只能包含单词SELECT,但是当用户点击它进行选择时,应该扩展到足以确保所有选项都完全可见,宽度方向。

When the page loads I want the drop down list to be small enough to only contain the word SELECT, but when the user clicks on it to make the selection, it should expand enough to make sure all the choices are fully visible, widthwise.

FF做到了,IE9做到了。但IE8可以切断宽度。

FF does it, IE9 does it. But IE8 cuts off the width.

任何修复?
谢谢

Any fixes? thanks

推荐答案

对于IE8,您需要使用一些JavaScript。还有JQuery插件也是这样做的,但是我认为没有使用js就没有办法。

For IE8 you will need to use some JavaScript for this. There are JQuery plugins that do this too, but I think there is no work around without using js.

看看这个其他SO线程用于您可能使用的不同方法和js库。

Take a look at this other SO thread for different approaches and js libraries you might use.

根据我的经验,最好的解决方案包括用一些其他HTML,CSS和JavaScript组合来替换select元素,因为尝试改变某些事件的原始选择的宽度会移动内容在右边。

In my experience, the best solutions involve replacing the select element with some other HTML, CSS and JavaScript combination, as trying to change the width of the original select on certain events will move the content on the right of it.

这篇关于控制IE8中的下拉列表宽度选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆