Struggling to center five PNG images on a simple website for a friend. Previously, using display: block; and margin: auto; for one picture worked, as shown below. However, my current code:
.middleContent{
width: 100%;
top: 50px;
position: relative;
}
h2{
font-family: helvetica;
font-size: 15px;
text-align: center;
float: left;
width: 20%;
position: relative;
top: 30px;
}
.middlePhoto1, .middlePhoto2, .middlePhoto3, .middlePhoto4, .middlePhoto5{
width: 15%;
padding-right: 2%;
padding-left: 2%;
}
<div class="mainContent">
<img class="topContent" src="img/homepage.jpg"></img>
<div class="middleContent">
<img class="middlePhoto1" src="img/icon1.png"></img>
<img class="middlePhoto2" src="img/icon2.png"></img>
<img class="middlePhoto3" src="img/icon3.png"></img>
<img class="middlePhoto4" src="img/icon4.png"></img>
<img class="middlePhoto5" src="img/icon5.png"></img>
</div>
</div>
After making some edits, the images now appear in the center of the screen but not quite centered on the screen. Despite using only 5% padding right and plenty of pixel space to the left, the fifth icon still won't fit. Frustrating, right?!