我可以在ie8中使用CSS改变选择元素的边框颜色/样式吗?

时间:2022-11-20 21:24:40

I have seen that the situation is very problematic after reading these:

我读了这些之后发现情况很有问题:

IE6/IE7 css border on select element http://api.jquery.com/css/

在select元素http://api.jquery.com/css/上的IE6/IE7 css边框

However maybe the situation has changed with Internet Explorer 8. If that is so, I'd expect this piece of code to work in IE8:

不过,随着Internet Explorer 8的出现,情况可能已经发生了变化。如果是这样的话,我希望这段代码能在IE8中工作:

 $(selectObject).css("border", "1px solid red");
 $(selectObject).css("border-style", "dashed");

This works as I expect in Firefox but not in Internet Explorer 8. (Nothing changes in IE 8). So either I'm forgetting something or IE8 is still broken (in the sense given by the context above).

这在Firefox中可以正常工作,但在Internet Explorer 8中不能。(在IE8中没有任何变化),所以我忘记了一些东西,或者IE8仍然被打破(从上面的上下文来看)。

If I'm forgetting something for IE8 then what is it?

如果我忘记了IE8的一些东西,那是什么呢?

If IE8 is definitely broken and cannot use CSS to change the properties of SELECT elements then do you have any authoritative source that explains this situation? (Along with possible work arounds?)

如果IE8确实被破坏了,并且不能使用CSS来更改SELECT元素的属性,那么您有任何权威的来源来解释这种情况吗?(还有可能的工作?)

2 个解决方案

#1


2  

IE8 and border css property on select menus

在选择菜单上的IE8和边框css属性

#2


1  

What you have worked in IE8, you can view a test here: http://jsfiddle.net/G7ThX/

您在IE8中所做的工作,可以在这里查看一个测试:http://jsfiddle.net/G7ThX/

Are you sure your page isn't in quirks mode?

你确定你的网页不属于怪癖吗?

As for alternative options, there are jQuery routes for replacing the rendered <select> all-together for UI purposes, like Stylish Select Box (latest code here), these are a bit more style-able, and maybe a better route if you want to do more than a border and render the same cross-browser.

至于其他选项,有一些jQuery路径用于替换呈现的

Most of these plugins work by hiding the <select> and using its options, but still setting its value in the background...the form knows no difference in posted values, so it's easy to drop in.

大多数插件通过隐藏

#1


2  

IE8 and border css property on select menus

在选择菜单上的IE8和边框css属性

#2


1  

What you have worked in IE8, you can view a test here: http://jsfiddle.net/G7ThX/

您在IE8中所做的工作,可以在这里查看一个测试:http://jsfiddle.net/G7ThX/

Are you sure your page isn't in quirks mode?

你确定你的网页不属于怪癖吗?

As for alternative options, there are jQuery routes for replacing the rendered <select> all-together for UI purposes, like Stylish Select Box (latest code here), these are a bit more style-able, and maybe a better route if you want to do more than a border and render the same cross-browser.

至于其他选项,有一些jQuery路径用于替换呈现的

Most of these plugins work by hiding the <select> and using its options, but still setting its value in the background...the form knows no difference in posted values, so it's easy to drop in.

大多数插件通过隐藏