2

I am trying to change the selected item of color in css . I tried but I am failed could someone please help me how to achieve my goals .

Thanks

select option:checked {
  color: #000 !important;
}
<select className="form-control input-box" {...input} required>
  <option value="">Task Type</option>
  <option value="Meeting">Meeting</option>
  <option value="FollowUp">Follow Up</option>
  <option value="Viewing">Viewing</option>
  <option value="reminder">Reminder</option>
  <option value="other">Other</option>
</select>
Dejan.S
  • 18,571
  • 22
  • 69
  • 112
Jonas
  • 261
  • 1
  • 3
  • 13

2 Answers2

1

Dropdowns are based on the user's operating system and not the browser per se. The best way to style dropdowns is to hide the default one and create a pseudo one instead.

Go through https://www.w3schools.com/howto/howto_custom_select.asp to find out how to implement this trick.

Alvin Moyo
  • 200
  • 1
  • 9
-1

 select {
    color:red;
}

option:not(:checked) { 
    color:black;
 }
<select className="form-control input-box">
        <option value="">Task Type</option>
        <option value="Meeting">Meeting</option>
        <option value="FollowUp">Follow Up</option>
        <option value="Viewing">Viewing</option>
        <option value="reminder">Reminder</option>
        <option value="other">Other</option>
    </select>
kompaniietst
  • 250
  • 3
  • 10