Set the color with multiple choices of the selection box if the selection box is focused

I am trying to style a tag <option>

so that there is no styling when an option is selected. The reason for this is that this is a " duallist block ", so I really don't need styles.

I was able to set the background color (white), but when the select menu is focused, it also sets the options text color to white.

I tried to set the color in the selection menu and options. I've tried using pseudo selectors. I've tried inline styles in both tags select

and option

. I don't seem to understand. Obviously this is possible as this link has the functionality I'm looking for, although similar css doesn't seem to work in my application.

If that helps, I set up a custom field in the admin section of Wordpress as a plugin. Everything works except for this style.

Also in Chrome. Although a cross browser solution would be best at the end.

Here are some of the rules I've tried. Along with using classes, ids and inline styles:

table select option,
table select option:hover,
table select option:focus,
table select option:active,
table select option:checked
{
    background: linear-gradient(#fff,#fff); /* works */
    color:red; /* does not work */
}

table select,
table select:focus,
table select:focus option,
table select:focus option:checked
{
    color:red; /* does not work */
}

      

UPDATE

The problem seems to be related to the parameters they have selected="selected"

on them. Here is a violin .

+3


source to share


1 answer


Give id ex: select your options and try css like below.



select option#opt {Background.:red;} 

      

-2


source







All Articles