1

I have the following drop down list:

<asp:DropDownList ID="ddlSubdivision" AppendDataBoundItems="true"
runat="server" Height="30px" Width="450px" AutoPostBack="True"
OnSelectedIndexChanged="SubDivision_Changed" CssClass="dropdown"
OnClick ="">

In this dropdown list, I want to change the color of the options on mouse over. By default, in Chrome it shows up as Blue, but I want to change it to red.

I have tried the following CSS code:

   .dropdown {
  position: relative;
  display: inline-block;
}

option::selection {
  background: #ffb7b7; /* WebKit/Blink Browsers */
}

But this does not seem to work. How to achieve the required functionality?

Ashesh Das
  • 365
  • 1
  • 8
  • 22
  • Styling dropdowns is very limited, it's usually best to use a plugin to create a html list so you can style that instead - [see this question](https://stackoverflow.com/questions/7208786/how-to-style-the-option-of-an-html-select-element). If you scroll down, there is [an answer](https://stackoverflow.com/questions/7208786/how-to-style-the-option-of-an-html-select-element#answer-28466918) that shows some plugins you can use – Pete Dec 10 '19 at 14:03

1 Answers1

0

You can try with:

!important

option:: selection { background: #ffb7b7 !important;}

Mickael Lherminez
  • 679
  • 1
  • 10
  • 29