Sandeep Sandeep - 1 year ago 295
CSS Question

option:checked is not working with IE 11

I have select tag and need to change background image of option based on selection. I am using style below, This style works with chrome but not working with IE 11. Not sure what changes I need to do to make it work on IE 11 ?

background-image: url("SelectBlue.png");
color: white;

Full HTML Code below

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>change demo</title>
div {
color: red;

<style type="text/css">

background-color: transparent;
font-family: verdana;
font-size: 8pt;
font-weight: bold;
color: black;

option:checked {
background-image: url("DataGridSelectBlue.png");
color: white;


<script src=""></script>

<input id="hid" type="hidden">
<select id="sweets" name="sweets" multiple="multiple" class="ListBox">
<option value="a">Chocolate</option>
<option value="b" selected="selected">Candy</option>
<option value="c">Taffy</option>
<option value="d" selected="selected">Caramel</option>
<option value="e">Fudge</option>
<option value="f"> Cookie</option>

<select name="food" multiple="multiple" class="ListBox">
<option selected="selected">Sambar</option>
<option selected="selected">Bisibele bhath</option>



Answer Source

After a deeper research

According to MDN the :checked CSS pseudo-class selector (basic feature) is compatible to IE11:

  • Chrome 1.0
  • Firefox (Gecko) 1.0
  • Internet Explorer 9.0
  • Opera 9.0
  • Safari 3.1


If so, the reason it might not work is that the property 'background-image' isn't fully browser-compatible.

I'm using chrome and have created the following codepen (based on your code) - you can test it on several browsers to see which property is being supported:

            option:checked {    
                background-color: green; /*Won't apply*/
                color: green; /*Won't apply*/
                border:1px solid green; /*Will apply (at least on chrome)*/
                background-image:url(''); /*Will apply (at least on chrome)*/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download