[Answered ]-Change background color in a select option dropdown

1👍

For the second style you need to use nth-of-type. But as CSS only it works:

select option[value="chair"] {
  background-color: red;
}

select option:nth-of-type(3) {
  background: green;
}
<select name="work" class="form-control" required="" id="id_work">
  <option value="" selected="">---------</option>
  <option value="chair">The chair</option>
  <option value="table">The table</option>
</select>
👤Azu

0👍

You can set some flag as well if there are only 2 drop-down values.

Leave a comment