I'm trying to make an effect of hover
to add a background-color
to my image but it does not work it creates background-color
behind the image I needed it to stay in front I'm using less
to do this follow my code
LESS:
.hover-box {
position: relative;
&:hover {
.img-thumb {
.opacity(.3);
background-color: @blue-dark;
}
.middle {
.opacity(1);
}
}
}
.img-thumb {
display: block;
width: 100%;
height: auto;
transition: .5s ease;
backface-visibility: hidden;
padding: 5px;
}
.middle {
transition: .5s ease;
color: @white;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
.opacity(0);
i{
font-size: 30px;
}
}
HTML:
<a href="assets/images/portfolio/thumb/media-thumb.jpg" data-rel="lightcase" title="Projeto-01">
<div class="hover-box">
<img src="assets/images/portfolio/media.jpg" class="img-responsive img-thumb" alt="Projeto 1" title="Projeto 1" />
<div class="middle text-center">
<i class="fa fa-search-plus" aria-hidden="true"></i>
</div>
</div>
</a>