The linear gradient works with the image but the texts does not appear on the image foreground. Also the gradient should not be on the texts. Where did I go wrong?
Any help will be much appreciated.
.glimage {
display: flex;
justify-content: flex-end;
flex-direction: column;
position: relative;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-size: cover;
background-position: center center;
background-image: url(/assets/img/rests/bangkok.jpg);
height: 220px;
}
.glimage:after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 100%), url(/assets/img/rests/scenery.jpg);
}
.gltext {
position:absolute;
color: #fff;
}
<div class="box">
<div class="glimage">
<div class="gltext">
<h2>Travelling</h2>
<p>These are texts.</p></div>
</div></div>