Page 1 of 1

Set a background color for options in combo box

Posted: Sun Oct 11, 2009 12:56 pm
by MicroBoy
I have a combobox, how to set a background color for a specified option. For example the option red to have Red background color etc.... I have searched a lot in google, but I didn't have any good results.

Re: Set a background color for options in combo box

Posted: Thu Oct 15, 2009 11:21 am
by akuji36
It sounds like you may need css.

Do you want to see the desired colored change

when a selection is made from a list of options

in your combo box?

Re: Set a background color for options in combo box

Posted: Mon Nov 09, 2009 5:45 am
by maneetpuri
HI,

Just define the background color in Option tag.

<select name="">
<option>Select Color</option>
<option style="background-color:red; color:#FFF">RED</option>
<option style="background-color:green; color:#FFF">GREEN</option>
<option style="background-color:black; color:#FFF">BLACK</option>
</select>

Hope This Helps,
Cheers

Re: Set a background color for options in combo box

Posted: Mon Nov 09, 2009 10:18 am
by pickle
Ya, you have to use CSS. The last I checked though, this doesn't work in Firefox.

Re: Set a background color for options in combo box

Posted: Mon Nov 09, 2009 1:59 pm
by MicroBoy
thnx maneetpuri, this Worked for me :D