繁体   English   中英

表格单元格内的div背景图像在Firefox上不起作用

[英]div background-image inside table cell does not work on Firefox

我有以下代码:

<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

感谢您的帮助。

尝试使用background-image:而不是background:

您可能必须分别设置背景属性:

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

取代这个

<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中都能显示图像

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM