简单地说,图像没有锚标记。以下是您需要做的:
当前代码
All Products HTML 代码如下所示:
<div class="best-seller-wrap">
<div class="second-img">
<div class="disount-text">
30% OFF
</div>
<div class="price-text-wrap">
<h3>$34.99</h3>
<p>
<a href="http://modulesoft.info/projects/gamesite/?product=dishonered">Buy Now..</a>
</p>
</div>
</div>
</div>
还有这样的 CSS:
#main .best-seller-wrap .second-img {
background-image: url('images/best-seller-images/img-2.png');
position: relative;
}
新代码
所有产品 HTML:
<div class="best-seller-wrap">
<div style="position: relative">
<a class="second-img" href="http://modulesoft.info/projects/gamesite/?product=dishonered"></a>
<div class="disount-text">
30% OFF
</div>
<div class="price-text-wrap">
<h3>$34.99</h3>
<p>
<a href="http://modulesoft.info/projects/gamesite/?product=dishonered">Buy Now..</a>
</p>
</div>
</div>
</div>
CSS:
#main .best-seller-wrap .second-img {
background-image: url('images/best-seller-images/img-2.png');
position: relative;
display: block;
}
您会注意到我正在将您的 .second-img 类应用于锚标记并将 display: block 添加到该类:
<a class="second-img" href="http://modulesoft.info/projects/gamesite/?product=dishonered"></a>
另请注意,我将position: relative 添加到周围的div
<div style="position: relative">
您的整个图像现在应该可以用作链接了。