我正在嘗試在圖像上疊加疊加。代碼工作不錯,但問題是我有另外一個DIV上覆蓋的頂部,我想覆蓋住,甚至當你將鼠標懸停即div
用CSS問題疊加圖像
HTML
.overlay {
position: relative;
}
.overlay img {
width: 100%;
vertical-align: top;
}
.overlay:after,
.overlay:before {
position: absolute;
opacity: 0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.overlay:after {
content: '\A';
width: 100%;
height: 100%;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.6);
}
.overlay:hover:after,
.overlay:hover:before {
opacity: 1;
}
.top-icons {
position: absolute;
z-index: 10;
margin: 5px 0 0 5px;
width: 100%;
display: none;
}
.post-img:hover .top-icons {
display: block;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
<div class="col-box">
<div class="post-img">
<div class="top-icons"><a href="">Test</a> Some text gose here</div>
<a href="#">
<div class="overlay">
<img src="http://placehold.it/300x300">
</div>
</a>
</div>
<div class="other">
</div>
<!--other-->
</div>
<!--col-box-->
</div>
<!--col-lg-3 col-md-4 col-xs-6-->
我想要的覆蓋工作,即使當你徘徊在div top-icons
請檢查jsfiddle。
感謝它的工作。真棒 – max