I'm trying to put a small box of text overtop of an image, with a header and paragraph following the image. Right now the floating box is disrupting the header, because the header is supposed to be centered but is getting pushed to the left.
Is this the best way to have a piece of text floating over an image?
.cell {
margin-top: 8px;
vertical-align: middle;
}
.galleryPic {
width: 80%;
max-width: 388px;
height: 100%;
max-height: 220px;
}
.imgDate {
top: -8vw;
right: 12vw;
color: white;
background-color: red;
width: 20vw;
position: relative;
z-index: 99;
text-transform: uppercase;
margin: 15px;
float: right;
padding: 1vw 2vw;
}
.cell h3 {
position: relative;
text-align: center;
}
.cell p {
position: relative;
}
<div class="cell">
<img class="galleryPic">
<div class="imgDate">Jan 9, 2019</div>
<h3>Header</h3>
<p>Paragraph</p>
</div>