我有这个下拉列表。我需要在选择后显示颜色,如果可能的话,当鼠标悬停在元素上时我需要透明选择而不是“蓝色”。
我需要这样的东西
<asp:DropDownList ID="ddlTimlineStatus" runat="server" Width="50px" CssClass="DropDownListStyle">
<asp:ListItem Value="G" style="background-color:green; color:green;"></asp:ListItem>
<asp:ListItem Value="Y" style="background-color:yellow; color:yellow;"></asp:ListItem>
<asp:ListItem Value="R" style="background-color:red; color:red;"></asp:ListItem>
</asp:DropDownList>
最佳答案
如果它是在浏览器中呈现的 select
下拉菜单,那么您可以更改 select 的 background
但您将无法更改突出显示颜色(当您悬停时) 通过使用 css! (适用于 Chrome 和其他 Webkit 浏览器)
您可能希望将 select
block 更改为 ul, li
结构。
关于c# - 需要在 asp 下拉列表中选择颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42973737/