My goal is to create a block button with a related icon. Since Bootstrap 4 does not natively support glyphicon anymore and I would prefer using fonts or SVG images over PNG images, I have chosen to use font-awesome v5.
My problem is that the icon is slightly above the text and does not want to center itself, no matter what I tried.
Several answers here on StackOverflow suggested using the vertical-align
property [1][2], but this seems to be completely ignored by the icon. I suppose this is due to the fact that both questions were asked in 2013 and font-awesome has been updated since then.
I tried messign with flexboxes, but this ended up moving both the text and the icon. I also tried applying the align-middle
class to the span, but it didn't work either.
Here is my code so far:
<div class="container">
<p>
<a class="btn btn-lg btn-primary btn-block" role="button">
<span class="fas fa-music fa-lg float-left my-icon"></span>
<span class="my-text">Music</span>
</a>
</p>
</div>
As you can see, the icon is still elevated over the text, and I have no idea how to align it vertically.