Is there any secret behind editing a option tag with css? I just can\'t solve this issue
I know this question is old, but there are some new developments in the world of CSS!
color
property on select
will now set color of option(s) text (including selected), while adding / over-riding color to select option
.
CSS:
select {
color: white; /* color of selected option */
}
select option {
color: black; /* color of other options */
}
<option> elements cannot contain anything other than text. So no, you can't apply a style to a section of their content.
Just don't use a <select>
, or don't bother about styling. From your use case, it doesn't really look suitable anyway. It'd be better just to type the name, wouldn't it?