【发布时间】:2015-08-28 02:57:14
【问题描述】:
问题:
我有两个 ASP.net Buttons 在 Chrome 和 Firefox 浏览器中可以正常工作,但在 IE 9.0 中却不行。
*Does not work on IE 9.0*
<asp:Button ID="btnMeal" runat="server" onclick="btnMeal_Click" Text="." CssClass="buttonmeal" />
*Works fine on IE 9.0 and other browsers*
<asp:Button ID="btnType" runat="server" onclick="btnType_Click" Text="." CssClass="button"/>
CSS 代码:
/*Doesnt work*/
.buttonmeal
{
background: url('../images/meal.png') no-repeat;
width:82px;
height:32px;
border:0px;
}
/*Works*/
.button
{
background: url('../images/type.png') no-repeat;
width:82px;
height:32px;
border:0px;
}
也许我认为问题在于它在 IE 中的呈现方式不同,并且在 IE 中只使用了按钮。
<td class="myStyle">
<input type="button" name="select" ...>
</td>
【问题讨论】:
-
您是否在 IE 中进行过硬刷新以确保它获得正确的 CSS?您还可以使用 IE 开发人员工具 (F12) 检查元素以了解发生了什么。
-
您的按钮之间的唯一区别是在
btnMeal之前带有空格`/>` 的结束标签和在btnType之前没有空格的结束标签/> -
IE 中的硬刷新修复了它。谢谢各位。