How can I set the background color of <option> in a <select> element?

mike picture mike · May 7, 2010 · Viewed 135.9k times · Source

How do you set the background color of an item in an HTML list?

Answer

user151323 picture user151323 · May 7, 2010

select.list1 option.option2
{
    background-color: #007700;
}
<select class="list1">
  <option value="1">Option 1</option>
  <option value="2" class="option2">Option 2</option>
</select>