FlyingDR / scss-snippets

Collection of helpful SCSS mixins and functions to use into various projects
1 stars 2 forks source link

Font icons for inline elements #20

Open FlyingDR opened 7 years ago

FlyingDR commented 7 years ago

Currently font icons are applied to elements and positioned absolutely against them. This approach gives incorrect result in a case if icon is applied to inline element that spans on multiple lines. Hence it is good idea to add support for applying font icons to such elements. It can be done by introducing inline parameter to font-icon() as applying font icons to inline elements will require different approach. Icon position will need to be positioned like this:

top: (line-height - 1em) / 2;
transform: none;

where line-height is line height value of the element itself. Since this value can't be obtained automatically - it should be required to pass it (as unitless or em value) as separate parameter.