2013-04-05 17 views
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> 
+0

你有沒有做過IE硬刷新,以確保它得到適當的CSS?您也可以使用IE開發人員工具(F12)來檢查元素以查看發生了什麼。 – NotMe 2013-04-05 13:58:04

+0

你的按鈕之間的唯一區別是在'btnMeal'和結束標籤'/>'之間帶空格'/>'的結束標籤'btnType'之前沒有空格。 – Morpheus 2013-04-05 14:00:17

+0

IE中的硬刷新修復了它。謝謝你。 – Apollo 2013-04-05 14:03:03

回答

0

最有可能的緩存問題(無論如何對我來說)。有一個很好的改變你的瀏覽器沒有使用你的CSS文件的最新版本。嘗試硬刷新:

鉻/ IE/Firefox的按Ctrl +[R