【问题标题】:Image wont show in div when using Chrome使用 Chrome 时图像不会显示在 div 中
【发布时间】:2015-06-04 13:41:38
【问题描述】:

我创建了一个网站,它在 Firefox 和 IE 上运行良好,但由于某种原因,图像不会显示在 Chrome 上的 div 中。该图像具有正确的 src,因为它适用于所有其他浏览器。如果我将“产品” div 重命名为其他名称,它会随机显示 chrome 中的所有内容,但是产品 div 的悬停效果等将不会生效。这是我的代码:

.product {
  float: left;
  margin-left: 20px;
  padding: 5px;
}
.product:hover {
  background-color: #dfdddd;
}
.tinfo {
  width: 300px;
  height: 50px;
  margin-top: -80px;
  position: relative;
}
.buy {
  float: right;
  margin-top: 14px;
}
a.add2 {
  color: #e9e9e9;
  opacity: 1;
  padding: 10px;
  background-color: #282828;
  border: 1px solid #282828;
}
a.add2:hover {
  color: #282828;
  background-color: #e9e9e9;
  text-decoration: none;
  border: 1px solid #282828;
}
<div class="product">
  <img src="images/myImg.png" class="imgSize">
  <div class="tinfo">Product info here
    <br>$00.00
    <div class="buy"><a href="cart.php?add=product1" class="add2">Add to cart</a>
    </div>
  </div>
</div>

【问题讨论】:

标签: html css google-chrome


【解决方案1】:

使用这个:

<div class="product">
  <img src="~/images/myImg.png" class="imgSize">
  <div class="tinfo">Product info here
    <br>$00.00
    <div class="buy"><a href="cart.php?add=product1" class="add2">Add to cart</a>
    </div>
  </div>
</div>

【讨论】:

  • 谢谢你,原来 Chrome 不喜欢产品 css 上的 float:left,所以我删除了那行代码,网站看起来仍然很好。感谢您的帮助!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-11
  • 2022-10-13
  • 2013-04-17
  • 2014-08-11
  • 2018-03-11
  • 1970-01-01
相关资源
最近更新 更多