I am trying to vertically and horizontally center align a small icon that I am putting on top of an image.
Relevant html part:
<li>
<a href="#">
<span class="test fa fa-play"></span>
<img src="thumbnail1-l.jpg" alt="">
</a>
</li>
<li>
<a href="#">
<span class="test fa fa-play"></span>
<img src="thumbnail2-l.jpg" alt="">
</a>
</li>
<li>
<a href="#">
<span class="test fa fa-play"></span>
<img src="thumbnail3-l.jpg" alt="">
</a>
</li>
<li>
<a href="#">
<span class="test fa fa-play"></span>
<img src="thumbnail4-l.jpg" alt="">
</a>
</li>
CSS part
.photo-list.cols-2 li {
width: 50%;
}
.photo-list li {
float: left;
width: 25%;
padding: 8px;
opacity: .8;
transition: opacity .3s ease-in-out;
}
.test{
position: absolute;
z-index: 1000000000;
font-size: 30px;
width: 60px;
height: 60px;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
}
The output looks like the following:
I would appreciate any help as to how I can align the icons right. Thanks!