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;
}
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;
}
I'm using the CSS below and it is working in latest IE11, Edge, Firefox and Chrome (I have not tested it with earlier browsers). Just remove border-radius and padding if you don't need them. And thanks to willrice for his contribution:
Appreciate this is an oldish question, but to prevent the blue background on a selected option in a select dropdown in IE, use the MS pseudo element -ms-value as mentioned by WillRice above. Importantly though you need to set a color css attribute as well for the text as this will get defaulted to white.
More info here
In Internet Explorer 11/Edge (not sure about previous versions) you can do this:
You should also specify the font color because it otherwise defaults to white (to originally contrast against the blue), so you'll want to override it too.
Here's a dabblet demo
I've been fiddling around with css and javascript and have searched the internet to find a solution. Unfortunately it looks like it's not possible to change IE's blue highlight itself. In the following example I've used a combination of CSS an JS to achieve nearly the same result in ie as you have on http://jsfiddle.net/TafDD/3/ . Have a look at it.
An example is worth a thousand words: (tested in IE7)
I hope this helps you.
I also recommend you have a look at:
…and an overview of 40 Techniques:
These sites will give you information on how to further style the select with css and / or javascript.
Have fun reading and happy coding!