2010-06-03 56 views
0

我正在使用背景图像作为按钮显示。该按钮显示在所有版本的Firefox,铬,歌剧等。但是,图像无法呈现在IE8本身。只有图像没有被显示,其他一些类的样式会被应用,例如宽度,高度等。 更令人困惑的是,在另一个页面(尽管是不同的类和样式表)中,显示了类似比例的图像类似的用法。图像格式为JPG。 我复制粘贴两种情况下的有效样式属性,如下面的萤火虫所示。IE8中的样式相关问题

没有显示下面的按钮。按钮类应用为class =“cart-button login”,class =“cart-button update”,class =“cart-button checkout”和class =“cart-button continue”,并且位于某些div内。

.cart-button{ 
    height: 28px; 
    cursor: pointer; 
    border: none; 
    float: left; 
} 

.cart-button:hover{ 
     background-position: 0 -28px; 
} 

.login{ 
    width: 58px; 
    background:url(/../../templates/animalcare/i/login.jpg)no-repeat; 
    margin:0 0 20px 0; 
    clear: both; 
} 

.update{ 
     width: 63px; 
     background:url(/../../templates/animalcare/i/update.jpg)no-repeat; 
     margin:0 0 20px 15px; 
     float: left; 
    } 

.checkout{ 
     width: 77px; 
     background:url(/../../templates/animalcare/i/checkout.jpg)no-repeat; 
     float:right; 
     margin:0 25px 30px 10px; 
    } 

.continue{ 
     width: 132px; 
     background:url(/../../templates/animalcare/i/continue.jpg)no-repeat; 
     float:right; 
     margin:0 0 30px 0px; 
    } 

以下是唯一显示的图像按钮。它位于一张桌子内。它在不同的样式表中 - 因此是路径差异。

.add-to-cart{ 
    width:102px; 
    height:28px; 
    float:left; 
    background:url(i/add_to_cart.jpg) no-repeat; 
    cursor:pointer; 
    border:none; 
    margin:10px 0 5px 0; 
} 

.add-to-cart:hover{ 
    background-position:0 -28px; 
} 
+0

在一个工程中,你在URL和'no-repeat'之间有一个空格。如果在URL和不重复的地方之间添加空格,会发生什么情况? – 2010-06-03 07:48:43

回答

4

我不能不注意到,这被显示的图像具有在no-repeat前面的空间,而这不是没有兴趣,没有。我想知道这是否会成为问题。例如:

.login{ 
    width: 58px; 
    background:url(/../../templates/animalcare/i/login.jpg) no-repeat; 
                 ^
                  +-- add this space 
    margin:0 0 20px 0; 
    clear: both; 
} 

(和所有其他)。

+1

+1“指向”的问题..;) – Reigel 2010-06-03 07:53:17

+0

谢谢T.J !!这是......问题解决了。我觉得自己像个笨屁股..... – abhis 2010-06-03 08:05:55

+0

@Ajith:好交易,很高兴就是这样。 (我们都会犯错误。) – 2010-06-03 08:19:01