Click to See Complete Forum and Search --> : style in a drop down list


221436
05-18-2004, 09:37 AM
Hi!!

I would like to put colour in some of the options of my drop down list, my code is the following (but it doesn' work):

<select>
<option value="one" style="color:yellow;background-color:blue">1</option>
<option value="two">2</option>
<option value="three">3</option>
<option value="four">4</option>
</select>

What do I have wrong? What can I do to add the colour to the option?

Thanks for you help.

Robert Wellock
05-18-2004, 12:47 PM
One way would be as below; obviously for the option you style that with CSS.

<style type="text/css">
<!--
select {
background-color: red;
color: white;}
-->
</style>

gazie
05-18-2004, 01:21 PM
I dont think he wanted to colour the entire selection box, just highlight some of the options indervidualy within the selction box with colour?

I don't think you can do that can you?

221436
05-18-2004, 01:23 PM
Thanks!

It seems that my code works in IE6 (I haven't tried because I have not got IE), but still it doesn't work in opera, konkeror or mozilla.

So, apparently, you can change the colour or background of an option, but it depends on the browser that it will be displayed with the colours or not.

Any suggestion on how can I make it works for opera, mozilla or konkeror?? :rolleyes: