Icon Fonts: Mind the Baseline

Icon Fonts: Mind the Baseline

At 4/19/2024

Earlier this week, I made my first custom icon font using IcoMoon (implemented with Filament Group’s “bulletproof” technique).

I set my grid sizes and exported, but all the icons felt a little higher than I wanted them to be in relation to their surrounding elements. I did some finagling in CSS, but found the results varied (sometimes wildly) between platforms.

After some fruitless Googling, I trudged through the font’s preferences and found the culprit: A rather diminutive baseline height value. In IcoMoon, this is under Preferences, then Font Metrics.

Here’s a quick example at the default height (6.25%):

Here are the same elements and icons, but with a larger baseline height (18.75%):

Lesson learned: If the icon font’s vertical alignment is off, adjust its baseline height before resorting to CSS tweaks.

The more you know…

Copyrights

We respect the property rights of others and are always careful not to infringe on their rights, so authors and publishing houses have the right to demand that an article or book download link be removed from the site. If you find an article or book of yours and do not agree to the posting of a download link, or you have a suggestion or complaint, write to us through the Contact Us, or by email at: support@freewsad.com.

More About us