I am working currently on my website and wanted to ask best solution for this situation.
Biggest struggle is that I need to put gradient over img
+ text and arrow icon.
I tried 2 different ways:
I was able to put gradient over image using
:after
, but now I don't know how to put text over image and that left arrow to the right of image.I used
<figure>
and<figcaption>
I think this solution isn't the best, using negative margins to put text over image. But on this case I am not able to use:after
solution.
I included photo — there you can see how it should look like. Also I am starting my coding career and if you notice bad practises please let me know!
figure {
display: inline-block;
margin: 15px 12px;
box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2);
}
figcaption {
margin-top: -80px;
}
figcaption p {
margin-top: 0px;
margin-bottom: 0px;
padding-left: 44px;
text-align: left;
color: #ffffff;
font-family: "Proxima Nova";
font-size: 25px;
font-weight: 700;
line-height: 35px;
}
.cs-text {
margin-top: -10px;
color: #b9b8b8;
font-family: "Proxima Nova";
font-size: 12px;
font-weight: 700;
letter-spacing: 1px;
text-transform: uppercase;
}
figcaption img {
position: relative;
float: right;
padding: 10px 35px 50px 0px;
}
.cs-item {
position: relative;
display: inline-block;
max-width: 430px;
max-height: 254px;
}
.cs-item:after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.11) 36%, rgba(0, 0, 0, 0) 46%);
}
<div class="case-study-items">
<div class="cs-item">
<img src="https://www.upload.ee/image/7272952/case-studies-item.png" alt="">
<p class="solgu">Melb Lashes</p><img src="https://www.upload.ee/image/7272954/left-arrow.png" /></p>
<p class="cs-text">Case-study</p>
</div>
<figure>
<img src="https://www.upload.ee/image/7272952/case-studies-item.png" alt="">
<figcaption>
<p>Melb Lashes<img src="https://www.upload.ee/image/7272954/left-arrow.png" /></p>
<p class="cs-text">Case-study</p>
</figcaption>
</div>