1
問題ASP.net按鈕:用的CssClass不工作
我有兩個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)來檢查元素以查看發生了什麼。 – NotMe 2013-04-05 13:58:04
你的按鈕之間的唯一區別是在'btnMeal'和結束標籤'/>'之間帶空格'/>'的結束標籤'btnType'之前沒有空格。 – Morpheus 2013-04-05 14:00:17
IE中的硬刷新修復了它。謝謝你。 – Apollo 2013-04-05 14:03:03