I need help aligning text horizontally in the center of an image, not the center of the page. I have tried adjusting margins but can't get it just right. Any suggestions?
Here is my current code:
<section class="people">
<h1>Our people</h1>
<div class="putin">
<img src="images/People/poetin.png" class="img1" alt="poetin">
<p>Vladimir Putin</p>
</div>
<div class="stalin">
<img src="images/People/stalin.png" class="img1" alt="stalin">
<p>Joseph Stalin</p>
</div>
<div class="peter">
<img src="images/People/peter.png" class="img1" alt="peter">
<p>Peter the Great</p>
</div>
</section>
This is how I'm styling it with CSS:
.people {
width: 100%;
height: 60vh;
background-color: #f1f1f1;
}
.people h1 {
text-align: center;
padding-top: 45px;
}
.putin p,
.stalin p,
.peter p {
margin-top: 280px;
margin-left: 17.66%;
float: left;
position: absolute;
text-align: center;
}