style in a drop down list

liunx

Guest
Hi!!<br />
<br />
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):<br />
<br />
<select><br />
<option value="one" style="color:yellow;background-color:blue">1</option><br />
<option value="two">2</option><br />
<option value="three">3</option><br />
<option value="four">4</option><br />
</select><br />
<br />
What do I have wrong? What can I do to add the colour to the option?<br />
<br />
Thanks for you help.<!--content-->EDIT: Well obviously you can.<!--content-->Works fine in IE6<br />
<br />
<select><br />
<option value="one" style="color:yellow;background-color:blue">1</option><br />
<option value="two" style="color:blue;background-color:yellow">2</option><br />
<option value="three" style="color:yellow;background-color:blue">3</option><br />
<option value="four" style="color:blue;background-color:yellow">4</option><br />
</select><br />
<br />
The focus is over the first one so it goes navy anyway.<!--content-->It doesn't work for opera, mozilla or konkeror.<br />
<br />
Any idea how can I do it for this browsers?? :confused: <br />
<br />
<br />
Thanks for your help.<!--content-->This works for me in Firefox (0.8)<br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>Untitled</title><br />
<style type="text/css"><br />
/*<![CDATA[*/<br />
<!--<br />
select {<br />
background: red;<br />
}<br />
--><br />
/*]]>*/<br />
</style><br />
</head><br />
<body><br />
<div><select><br />
<option value="one">1</option><br />
<option value="two">2</option><br />
<option value="three">3</option><br />
<option value="four">4</option><br />
</select></div><br />
</body><br />
</html><!--content-->But... this only works for the entire list and not for only some of the options, right?<br />
<br />
I was trying to make it work for only some of the options, I know that the code is rigth but the problem is in the browser.<br />
<br />
Is there any way I can make it work for different browsers??<!--content-->Could you style the select tag for all browsers, then use inline styles for your options so the browsers that can handle it can have diff colors?<!--content-->mmmm.... that could work!!! :p <br />
<br />
I will try that way.<br />
<br />
Thanks for helping!!<!--content-->np :)<!--content-->
 
Back
Top