Is there a more efficient way to overlay text on an image without using position: absolute;
? Dealing with position: absolute;
for different screen sizes isn't the ideal solution for me. I've searched for alternatives, but all I keep finding is the conventional advice: use position absolute.
HTML:
<div class="header-container">
<img src="https://media.sproutsocial.com/uploads/2018/04/Facebook-Cover-Photo-Size.png" alt="" id="header-img" />
<p class="img-text">Make it possible!</p>
</div>
CSS:
#header-container {
max-height: 800px;
display: flex;
align-items: center;
justify-content: center;
}
.text-header {
position: absolute;
font-family: "Gayathri", sans-serif;
font-weight: 1000;
top: 45%;
left: 45%;
}