Click here to Skip to main content
16,020,673 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to Change Dropdown listitem hover color change its bydefault blue i want gray.
ASP.NET
<asp:DropDownList ID="DropDownList1" runat="server">
           <asp:ListItem Text="A" />
           <asp:ListItem Text="B" />
           <asp:ListItem Text="C" />
           <asp:ListItem Text="D" />


When I go A other wise b The hover color is blue i need a gray.
Posted
Updated 28-Jul-15 3:38am
v2

1 solution

You can write CSS for applying it for all the dropdownlist-
CSS
select > option:hover {
   background-color:  #FF0000;
 }


To apply it to a particular dropdownlist, you can write something like-
CSS
select[id$='DropDownList1'] > option:hover {
   background-color:  #FF0000;
 }


Hope, it helps :)
 
Share this answer
 
Comments
Sandy W 29-Jul-15 4:37am    
i am trying this but not change anything.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
s select > option:hover {
background-color: #FF0000;
}
</style>
</head>
<body>
<form id="form1" runat="server">

<div> <style type="text/css">
select[id$='DropDownList1'] > option:hover {
background-color:red;
}
</style>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="A" />
<asp:ListItem Text="B" />
<asp:ListItem Text="C" />
<asp:ListItem Text="D" />

</div>

</form>
</body>
</html>
Sandy W 29-Jul-15 4:38am    
i am trying both.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900