I am attempting to overlay text on top of an image using the following code:
.gallery-image {
position: relative;
}
h2 {
position: absolute;
top: 200px;
left: 0;
width: 100%;
}
h2 span {
color: white;
font: bold 24px/45px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
<div class="gallery-image">
<a href="#">
<img src="image.jpg" width="280">
</a>
<h2><span>Text</span></h2>
</div>
Unfortunately, my text is appearing behind the image. How can I resolve this issue?