I am struggling with positioning a play icon overlay on the image in my list-group-item
. The current issue is that the icon is centered on the entire list-group-item
instead of just the image itself. I am working with bootstrap 4.4.1.
Here is the HTML structure:
<div class="video-list-stacked">
<ul class='list-group video-list-container'>
<li id="some-guid-01" class="list-group-item video-item">
<div class=video-item-img>
<img src="https://via.placeholder.com/140x100" />
<img class="video-item-playicon" src="https://images.vexels.com/media/users/3/131784/isolated/preview/a9ff82db0cf438516e13b8c3bf918a00-play-flat-icon-by-vexels.png">
</div>
<div class="video-item-details">
<h4>Video Title 1</h4>
<div>Description for Video Title 1. A little description that elaborates what this is. The description should take not more than two lines.</div>
<span class="video-item-tag">Tag One</span>
<span class="video-item-tag">Some other tag</span>
<span class="video-item-tag">Some other tag</span>
<span class="video-item-tag">Some other tag</span>
<span class="video-item-tag">Some other tag</span>
</div>
</li>
</div>
Applicable CSS:
.video-item{
display: flex;
padding-left: 5px;
}
.video-item-details {
padding-left: 10px;
}
.video-item-tag {
background: #2196F3;
padding: 2px 10px 2px 10px;
float: left;
margin: 2px;
margin-bottom: 5px;
border-radius: 100px;
color: white;
font-family: monospace;
font-size: 8pt;
position: relative;
cursor: pointer;
text-align: center;
}
.video-item-playicon {
position: absolute;
width: 60px;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
pointer: center;
}
I need help to ensure that the play icon appears perfectly centered on the image. Any suggestions?