I'm attempting to center a font-awesome
icon on top of an image within bootstrap 3
.
Below is the image code enclosed in a div:
<div id="quickVideo">
<a data-fancybox href="https://player.vimeo.com/video/153113362?autoplay=1&color=54b3e4" class="adminDemoVideo">
<img src="~/Images/..." class="img-responsive">
</a>
</div>
I managed to achieve this using ::before
on the div element, but the issue is that it lacks responsiveness.
.adminDemoVideo::before {
font-family: 'FontAwesome';
content: '\f04b';
margin-top: 1.35em;
margin-left: 2.8em;
color: white;
z-index: 1000;
font-size: 50px !important;
position: absolute;
padding-bottom: 3px;
padding-top: 3px;
padding-left: 25px;
padding-right: 15px;
background-color: rgba(23, 35, 34, 0.75);
border-radius: 5px 5px 5px 5px;
}
Here's how it appears in desktop display size:
https://i.sstatic.net/5gJj1.png
However, when transitioning to mobile or tablet view sizes, it becomes distorted due to margins, as shown below:
https://i.sstatic.net/3Erpi.png
Is there a way to resolve this without relying on specific screen sizes? Whether through css
, javascript
, or jquery
, any solution would be appreciated.
I hope this isn't a duplicate question; I couldn't find a suitable answer elsewhere...
Thank you in advance.