how to change the color of the dropdown text that I am given red but initially it look like black when we click that it look like red, so how to change that initially it look like red color
<select>
<option style="color:red">one</option>
<option style="color:red">two</option>
</select>
CodePudding user response:
You should apply the style to the select, not to the option.
Setting style="color:red"
will set the color of the option to red.
Setting style="color:green"
will set the color of select to green
<select style="color:green">
<option style="color:red">one</option>
<option style="color:red">two</option>
</select>
If you dont want the color of options to be updated, use color: initial
for the option.
select {
color: red;
}
select option {
color: initial;
}
<select>
<option>one</option>
<option>two</option>
</select>
CodePudding user response:
What i understood is, you want the drop-down texts in red before clicking it.
<Select style="color:red">
<option>one</option>
<option>two</option>
</select>