I am trying to make a nice hover transition with a gradient background over an image. The problem is I can't get the transition to work on the gradient background. So I moved it behind the image instead of on top and set the opacity of the image on hover. However, now the H2 won't show up very well because it is a child of the image div.
https://jsfiddle.net/landon1013/b0L6yx25/2/
HTML
<div class="gradient">
<div class="image">
<h2>
Jake Brown
</h2>
</div>
</div>
SCSS
.gradient {
align-items: flex-end;
display: flex;
flex-basis: 0;
flex-grow: 1;
background: linear-gradient(to right, rgba(195, 32, 52, 0.83) 0%, rgba(36, 11, 54, 0.83) 100%);
width: 300px;
height: 300px;
.image {
align-items: flex-end;
background-image: url(https://huish.landoncall.com/wp-content/uploads/2019/03/emily-jacobsen.jpg);
background-size: cover;
display: flex;
height: 100%;
width: 100%;
h2 {
color: white;
display: none;
padding-left: 20px;
}
&:hover {
opacity: 0.2;
transition: opacity ease-in 0.7s;
h2 {
display: initial;
}
}
}
}