在懸停時創建與img
疊加的最佳方式是什麼?我在項目中使用框架基礎。我試過這個代碼,但它並不能很好地工作:使用img覆蓋懸停?
這裏是我的代碼:http://jsfiddle.net/fLsu5jzk/
<div class="other_services">
<div class="small-12 medium-3 large-3 columns">
<div class="image-box">
<img src="http://s8.postimg.org/ithka8iv9/cleaning_of_shopping_centers.png" alt="">
</div>
<div>some text here</div>
<img src="http://s22.postimg.org/u877u6rlp/icon_shop.png" alt="" class="icon-hidden">
</div>
</div>
.other_services {
font-size: 14px;
font-family: 'Open Sans', sans-serif;
}
.other_services img {
max-height: 117px;
max-width:200px;
}
.image-box {
position:relative;
}
.image-box img {
width:100%;
vertical-align:top;
}
.image-box:after {
content:'\A';
position:absolute;
width:24%; height:100%;
top:0; left:0;
background:rgba(0,0,0,0.6);
opacity:0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.image-box:hover:after {
opacity:1;
}
.image-box:hover + .icon-hidden{
display: block;
}
.other_services .icon-hidden {
position: absolute;
z-index: 200;
max-width: 133px;
margin: -40% 0 0 24%;
display: none;
}
有什麼想法?
「最好的方式」的問題是基於意見的,因此對於SO來說是不合適的。 –
正在尋找類似的東西[** JSFiddle **](http://jsfiddle.net/vivekkupadhyay/fLsu5jzk/1) PS:它雖然不是最好的方式;) – vivekkupadhyay