在未打开的聚焦选择框上更改IE背景颜色

在未打开的聚焦选择框上更改IE背景颜色

本文介绍了在未打开的聚焦选择框上更改IE背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从IE下更改蓝色背景颜色,但是我似乎找不到任何CSS这样做。

 < select id = focusSelect>< option>选项< / option>< / select& 

JS:

  document.getElementById(focusSelect)。focus(); 

CSS:

 code> select:focus {
background-color:red;
}
解决方案

在Internet Exploder 11(不确定以前的版本),你可以这样做

  select:focus ::  -  ms-value {background :red;} 


I'd like to change the blue background color from IE when a drop down is focused, but I can't seem to find any CSS to do this.

<select id=focusSelect><option>Option</option></select>

JS:

document.getElementById("focusSelect").focus();

CSS:

select:focus{
    background-color: red;
}

http://jsfiddle.net/TafDD/3/

Specifically this is for when the drop down is not open. Styling the options is not a problem.

I also can't find any definitive answer on whether this is possible to do at all.

Setting the option background color also does not clear the blue color.

option {
    background-color: green;
}

http://jsfiddle.net/srycroft/yE2Zg/

解决方案

In Internet Exploder 11 (not sure about previous versions) you can do this

select:focus::-ms-value {background: red;}

Here's a dabblet demo

这篇关于在未打开的聚焦选择框上更改IE背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 13:37