表格单元格中的div background-image在Firefox上不起作用

时间:2013-10-02 13:44:06

标签: html css

我有这段代码:

<table class="pricetable">
<tbody>
<tr style="background-color: #E6E6E6 !important;">

<td rowspan="4" class="iti">
<div class="itemTableImage" style="background: url(http://www.storagerealm.com/images/intel-ssd-520.jpg) no-repeat; background-size: 100% 100%;"></div>
</td>

<th>Capacity</th>
<th>Price</th>
</tr>
<tr style="border: 1px solid black;">
<td class="cell1">128 GB</td>
<td class="cell2">$129.99</td>

</tr>
<tr style="border: 1px solid black;">
<td class="cell1">256 GB</td>
<td class="cell2">$229.37</td>

</tr>
<tr>
<td class="cell1">512 GB</td>
<td class="cell2">$444.99</td>

</tr>
</tbody>
</table>

和CSS是:

.pricetable {
    width: 100%;
    height: 275px;
    border: 3px solid black;
    margin: 0.5em auto 1em; 
    text-align: center; 
    border-collapse:separate; 
    border-spacing:5px 5px;
}

.iti {
    width: 275px;
    background-color: #FBF5EF;
}

div.itemTableImage {
    width: 97%;
    height: 97%;
    margin: 0 auto;

    box-shadow: 0 0 8px rgba(0, 0, 0, .8);
    -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, .8);
    -moz-box-shadow: 0 0 8px rgba(0, 0, 0, .8);
}

我对Chrome,Safari和Opera的结果很满意,但Firefox和IE不会查看该产品的图片。

这是我在Chrome上获得的结果:

http://oi40.tinypic.com/35hgxuq.jpg

这就是我在Firefox上获得的:

http://oi40.tinypic.com/ra3vo4.jpg

感谢您的帮助。

3 个答案:

答案 0 :(得分:0)

尝试使用background-image:代替background:

答案 1 :(得分:0)

您可能需要单独设置背景属性:

background-image: url(http://www.storagerealm.com/images/intel-ssd-520.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;

答案 2 :(得分:0)

替换此

<td rowspan="4" class="iti">
<div class="itemTableImage" style="background: url(http://www.storagerealm.com/images/intel-ssd-520.jpg) no-repeat; background-size: 100% 100%;"></div>
</td>

<td rowspan="4"  class="itemTableImage" style="background: url(http://www.storagerealm.com/images/intel-ssd-520.jpg) no-repeat; background-size: 100% 100%;width: 275px; background-color: #FBF5EF; ">

我测试过它在crome和firefox中显示图像