1
我一直試圖在div內的圖像上創建一個遮罩,但遮罩並未覆蓋div的整個區域(在中間留下空白)。一直試圖解決它,但無法找到解決方案。在懸停的整個div上創建遮罩
這是我的進步 - http://jsfiddle.net/E2aWr/164/
.image-container {
width: 254px;
height: 280px;
margin: 10px;
float: left;
border: 5px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
box-shadow: 0px 0px 5px #aaa;
cursor: default;
}
.image-container .mask, .image-container .content {
width: 250px;
height: 280px;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
}
.image-container img {
display: block;
position: relative;
}
.image-container a.info {
background:url('link.png') center no-repeat;
display: inline-block;
text-decoration: none;
padding:0;
text-indent:-9999px;
width:20px;
height:20px;
}
.effect .mask {
opacity: 0;
overflow:visible;
border:100px solid rgba(0, 0, 0, 0.7);
box-sizing:border-box;
transition: all 0.4s ease-in-out;
}
.effect a.info {
position:relative;
top:-10px;
/* Center the link */
opacity: 0;
transition: opacity 0.5s 0s ease-in-out;
}
.effect:hover .mask {
opacity: 1;
border:100px solid rgba(0, 0, 0, 0.7);
}
.effect:hover a.info {
opacity:1;
transition-delay: 0.3s;
}
<div class="image-container effect">
<img src="http://www.istudy.net.my/images/shop/manufacturer/resized/bc_220x280.jpg.png" />
<div class="mask">
<a href="#" class="info" title="Full Image">Full Image</a>
</div>
</div>