Align SVG Icons to Text and Say Goodbye to Font Icons
Elliot Dahl:
At Pivotal we’ve created an SVG icon system with React for use on our suite of products. This article is about my approach to styling the SVG icon system with CSS to make it easy and effective to use.
Alignment and icons (of any sort) will probably always be a bit tricky. It depends on two things that will be different on every site: the font and the icons. Elliot was able to get perfect alignment with Arial by pulling the icons down with bottom: -0.125em;
because Arial sites right along the baseline and the icons themselves were designed with a 12.5% ring of white space around the edges. It’s a fairly common practice to design SVG icons with space along the edges (as annoying as it might be for alignment) because without the space, you might get awkward clipping on the edges with certain browsers/resolutions/zooming/etc (sorry I don’t have more detail handy).
Direct Link to Article — Permalink
Align SVG Icons to Text and Say Goodbye to Font Icons is a post from CSS-Tricks