I'm working on a CSS grid layout where I want to overlay text on an image. Below you can see the code I currently have without the text overlay.
.sbp-item12 {
grid-row: 6 / 7;
grid-column: 9/13;
height: 250px;
}
<div class="sbp-item12">
<a href="#">
<h3>Here is a headline</h3>
<figure>
<img src="https://placehold.it/380x250">
</figure>
</a>
</div>
I attempted to add the following snippet to the code, but then the text ends up at the bottom of my page rather than staying within the grid item. Any suggestions on how I can successfully place text over the image in my grid item?
.sbp-item12 {
grid-row: 6 / 7;
grid-column: 9/13;
height: 250px;
}
.bottom-left {
z-index: 100;
position: absolute;
color: white;
font-size: 24px;
font-weight: bold;
left: 0;
right: 0;
bottom: 0;
}
<div class="sbp-item12">
<a href="#">
<div class="text-bottm-left">
<h3>Here is a headline</h3>
</div>
<figure>
<img src="https://placehold.it/380x250">
</figure>
</a>
</div>