【发布时间】:2014-11-24 09:35:57
【问题描述】:
我正在尝试制作悬停图像并添加指向 div 的链接,但 div 不适合页面。
例如: http://test.peterstavrou.com/
看看图像是如何被截断的?
有人有什么想法吗?
下面是我的代码。
CSS
#cf {
position:relative;
margin:0 auto;
}
#cf img {
position:absolute;
left:0;
-webkit-transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-o-transition: opacity 1s ease-in-out;
transition: opacity 1s ease-in-out;
}
#cf img.top:hover {
opacity:0;
}
HTML:
<a href="http://www.peterstavrou.com/product/ebay-listing-template/"><div id="cf"><img class="bottom" src="http://www.peterstavrou.com/wp-content/uploads/2014/11/eBay-Listing-Template-Price.jpg" alt="eBay Template Listing" width="292" height="311" /><img class="top" src="http://www.peterstavrou.com/wp-content/uploads/2014/11/eBay-Listing-Template.jpg" alt="eBay Template Listing" width="292" height="311" /></div></a>
<strong>Summary:</strong> TEST TEST TEST
<a title="eBay Template Listing" href="http://www.peterstavrou.com/product/ebay-listening-template/">Click here for more information.</a>
jsFiddle http://jsfiddle.net/hz80govj/
【问题讨论】:
-
“适合页面”到底是什么意思?例如,填充 100% 的视口?
-
例如请参阅test.peterstavrou.com 看看图像是如何被截断的?