I am exploring how to implement hover-shadow effects on images within my cards. Although it is working fine, I am struggling with making the hover effect stay when I move my mouse to the title. It seems a bit off without this behavior.
Moreover, I wonder if there is a more "intelligent" way to achieve this effect in my code. Currently, it feels quite complex with all the positions and transformations involved.
.top-galleria-shadow {
height: 100%;
background: black;
opacity: 0.6;
}
.top-galleria-shadow:hover {
opacity: 0;
transition: 0.6s;
}
.galleria-section, .most-popular-products-section {
width: 100%;
display: flex;
justify-content: space-between;
}
.galleria-section > div {
width: 285px;
height: 285px;
}
.galleria-section > div:first-child {
background: url("https://hips.hearstapps.com/pop.h-cdn.co/assets/15/27/2048x1024/landscape-1435758551-m3.jpg?resize=480:*");
background-size: cover;
}
.galleria-section > div:nth-child(2) {
background: url("https://hips.hearstapps.com/pop.h-cdn.co/assets/15/27/2048x1024/landscape-1435758551-m3.jpg?resize=480:*");
background-size: cover;
}
.galleria-section > div:nth-child(3) {
background: url("https://hips.hearstapps.com/pop.h-cdn.co/assets/15/27/2048x1024/landscape-1435758551-m3.jpg?resize=480:*");
background-size: cover;
}
.galleria-section > div:last-child {
background: url("https://hips.hearstapps.com/pop.h-cdn.co/assets/15/27/2048x1024/landscape-1435758551-m3.jpg?resize=480:*");
background-size: cover;
}
.galleria-section p {
color: #FFFFFF;
font-weight: bold;
font-size: 20px;
z-index: 2;
bottom: 60px;
position: relative;
left: 50%;
transform: translateX(-50%);
text-align: center;
}
<div class="top-galleria">
<h3 class="block-title-h3">Lorem</h3>
<p>Lorem</p>
<div class="galleria-section">
<div>
<div class="top-galleria-shadow"></div>
<p>Title1</p>
</div>
<div>
<div class="top-galleria-shadow"></div>
<p>Title2</p>
</div>
<div>
<div class="top-galleria-shadow"></div>
<p>Title3</p>
</div>
<div>
<div class="top-galleria-shadow"></div>
<p>Title4</p>
</div>
</div>