Internet Explorer中的DropDownList宽度 [英] DropDownList width in Internet Explorer
问题描述
我有一个内容相当宽的ASP.NET DropDownList,而由于网站的空间限制,封闭列表的宽度必须非常小。这就是为什么我需要能够在关闭时为列表设置特定宽度,但希望它在打开时与内容一样宽。
I have an ASP.NET DropDownList with a rather wide content, while the closed list's width has to be quite small due to room limitations on the site. That's why I need to be able to set a specific width to the list when it's closed, but want it to be as wide as the content when it's opened.
默认情况下,Firefox在打开时自动使DropDownLists与其内容一样宽。另一方面,Internet Explorer没有。
By default, Firefox automatically makes DropDownLists as wide as its content when opened. Internet Explorer on the other hand does not.
有没有办法告诉IE将打开的DDL与打开时的内容一样宽,但是在关闭时将其缩小?最好不要使用javascript。
Is there any way to tell IE to make the opened DDL as wide as the content when it's opened, but have it in a smaller size when closed? Preferably without using javascript.
编辑:好的,我在第一篇文章中不够清楚。重点是打开时。列表关闭时我想要一个特定的宽度,但是我希望它在打开时与内容一样宽。正如我所说,Firefox做到这一点,IE没有。
Ok, I wasn't clear enough in my first post. The emphasis is on when opened. I want a specific width on the list when it's closed, but I want it to be as wide as the content when opened. As I said, Firefox does this, IE does not.
推荐答案
我建议不要使用下拉列表,但是更多javascript友好的这样的
I'd recommend not using the drop down list, but a more javascript friendly one like this
http ://jquery.sanchezsalvador.com/samples/example.htm
这将允许您的内容超出选择宽度。
This will allow your content to expand past the selects width.
这篇关于Internet Explorer中的DropDownList宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!