Closed johnaau closed 3 years ago
That seems to be a general issue. I saw this in a simple paragraph:
<p style="font-size:2rem;">some text <i class="bi-calendar"></i> some other text</p>
All icons have lower alignment as the text, independent from any vertical alignment for the paragraph.
After testing a lot, i have to admit, that the position seems technically correct. As soon as you add some characters with descenders, the icon is positioned correct in the middle. I noticed the problem after switching from FontAwesome to Bootstrap Icons and at some point FA seems to have a smarter solution for the icon positioning in text paragraphs. Text without descenders combined with a bootstrap icon looks really ugly, but at this point i have no idea how to improve that.
In the following sample the calendar icon is bootstrap and the clock icon is font awesome (there is no different css):
FontAwesome uses more specific vertical-align
values, including custom vertical-align
and sizing for large (and maybe small?) sized icons. I could see about adding something like this ourselves, too. If anyone wants to experiment with additional values, I'm down to help review and test PRs or even CodePen demos :).
That said, closing as duplicate of #82.
I've noticed when using the Bootstrap Icon web font that the icons don't vertically align well with the surrounding text.
After changing vertical-align from text-bottom to text-top they align much better.
Some examples of icons placed alongside text and in buttons: