1
I’m trying to make an effect of hover
to add a background-color
in my image but does not work it creates the background-color
Behind the picture I needed her to stay in front I’m using less
to do this follows 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>
Have you tried adding the
z-index: 1
– Yago Azedias
s and does not work
– Felipe Henrique