<div class="container">
<figure>
<img src="https://i.imgur.com/jFKonXQ.jpeg" alt="White and Red Chevrolet">
<figcaption>Chevrolet</figcaption>
</figure>
</div>
.container {
margin: 0 auto;
position: relative;
width: 70%;
}
figure {
width: 100%;
}
figure img {
display: block;
height: 100%;
object-fit: cover;
width: 100%;
}
figure::before {
background-image: linear-gradient(to top right, #1a1a1a, transparent);
content: "";
height: 100%;
position: absolute;
width: 100%;
}
figcaption {
margin: 0;
font-weight: bold;
font-size: 3em;
position: absolute;
bottom: 0.7em;
color: #ffffff;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.