Given the following HTML code:
<select>
<option>yellow</option>
<option>red</option>
<option>blue</option>
</select>
For example, changing the color of second character in text "blue".
Given the following HTML code:
<select>
<option>yellow</option>
<option>red</option>
<option>blue</option>
</select>
For example, changing the color of second character in text "blue".
I do not believe there is currently a way to do that in CSS or (X)HTML. As "DaneSoul" pointed out, you could style the <option>
s themselves, but you can't individually style different parts of the text inside of them.
The <option>
tag cannot have any children other than a text node.
This question/answer has more information, confirming this.
<select>
<option id='option1'>yellow</option>
<option id='option2'>red</option>
<option id='option3'>blue</option>
</select>
Then add styles in CSS
#option3{ color: blue; }
If you need do it in dynamic, you can use JQuery:
$("#option3").css("color", "blue");
The only way this could be done is to create your own drop down list with DIVs, SPANs, perhaps a UL or two, and a bit of JavaScript (something like a CSS dropdown navigation menu cxould work too I suppose) then use JavaScript to set the value to be sent for your form.
Probably more work than it's worth.