【发布时间】:2018-05-21 11:34:00
【问题描述】:
我有一个 ASP.NET gridview 控件,在最后一列中有一个字体很棒的垃圾桶图标。
在 mouseover 上我希望颜色变为红色,然后再回到默认值onmouseout。
这是 asp.net 网格视图中的template field:
<asp:TemplateField HeaderText="Delete?" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<span ID="lnkDelete" style="border:none" onclick="return confirm('Are you sure you want to delete this Performance Review?')"
runat="server" ItemStyle-CssClass="fa fa-trash-0"
onmouseover="this.style='color:red;'"
CommandName="Delete">
<i class="fa fa-trash-o" onmouseover="script:this.style='color:red; font-size:24px'" onmouseout="script:this.style='color:black; font-size:24px'"
style="font-size:24px;"></i>
</span>
</ItemTemplate>
</asp:TemplateField>
在 IE 中呈现为
<span id="ctl00_m_g_10488b48_1486_45be_8a9c_efc307c0cb4b_ctl00_grdPR_ctl04_lnkDelete" style="border: currentColor;"
onclick="return confirm('Are you sure you want to delete this Performance Review?')" CommandName="Delete" ItemStyle-CssClass="fa fa-trash-0">
<i class="fa fa-trash-o" style="font-size: 24px;" onmouseover="script:this.style='color:red; font-size:24px'"></i>
</span>
但我显然弄错了,因为当我将鼠标悬停在垃圾桶图标上时没有任何变化。
我也尝试在我的页面中使用 css hover 样式,但同样没有任何反应:
<style>
.fa fa-trash-o{
color: black
}
.fa fa-trash-o:hover{
color:red;
}
</style>
那我哪里错了?
【问题讨论】:
-
更正选择器
.fa.fa-trash-o
标签: css asp.net font-awesome onmouseover onmouseout