我有用于添加和删除的 gridview 按钮,我使用 css 为每个按钮显示图标。它在 firefox 中运行良好,但图标未显示在 IE 或 Chrome 中,这是我的 css 代码
.delete {
display: inline;
background: url('delete.ico') no-repeat;
border: none !important;
background-position: -0px -0px;
width: 20px;
height: 20px;
float: none;
}
.edit {
display: inline;
background: url('edit.ico') no-repeat;
border: none !important;
background-position: -0px -0px;
width: 20px;
height: 20px;
float: none;
}
[编辑] 这是 html 按钮
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="BtnDelete" runat="server" CssClass="delete" CommandName="Removal" OnCommand="BtnDelete_Command" CommandArgument='<%# DataBinder.Eval(Container,"RowIndex")+";"+Eval("code")+";"+Eval("name") %>' OnClientClick="return not_check1();" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="BtnEdit" runat="server" CommandName="Edit" Text="" CssClass="edit" OnCommand="BtnEdit_Command" CommandArgument='<%# DataBinder.Eval(Container,"RowIndex")+";"+Eval("code") %>' />
</ItemTemplate>
</asp:TemplateField>
最佳答案
代替 display: inline;,尝试使用 display: inline-block; 请记住,您不能将高度设置为 inline元素。
关于html - 图标 .ico 扩展名在 IE 或 Chrome 中不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23262228/