- This topic has 9 replies, 3 voices, and was last updated 7 years, 4 months ago by
Tom.
-
AuthorPosts
-
April 4, 2016 at 12:21 pm #184166
morriscountynj
I was wondering about the use of what I’m assuming is FontAwesome for the search icon, menu icon, etc. There’ve been many arguments as of late regarding icon fonts, and actually replacing them with SVG icons or an SVG icon sprite. I personally just switch our custom social media icons from a font to an SVG sprite.
Is this something you’re considering in the future?
April 4, 2016 at 2:20 pm #184199Tom
Lead DeveloperLead DeveloperDefinitely something to consider, except that IE8 doesn’t have support for SVG icons.
However, it’s definitely something for me to look into to see if it would be better performance-wise.
April 5, 2016 at 5:39 am #184315morriscountynj
What you do is your use a png as a fallback, this is a good guide
I found a fallback not referenced here when using an SVG sprite. My code looks like
.icon { display: inline-block; background-repeat: no-repeat; background-image: url(sprite.svg); background-image: url(sprite.png)\9; }
The \9 line is read by IE9 and below. I have no idea why it works but it does π When you look at it in the Dev Tools of IE, IE8 emulated, the svg line is actually crossed out and the png line is what it renders.
π
April 5, 2016 at 12:05 pm #184454Tom
Lead DeveloperLead DeveloperInteresting, and the perk to doing this is better quality icons than using Font Awesome?
April 5, 2016 at 12:56 pm #184478morriscountynj
Mainly for accessibility reasons, among others, all listed pretty well here: http://blog.cloudfour.com/seriously-dont-use-icon-fonts/
Also the fonts themselves are usually bigger in size than an SVG/SVG sprite, and sometimes people turn off custom webfonts, or they just don’t render at all, leading to useless text on the page π
This came up for me because for fun, I was testing out one of my sites in Opera Mobile, which is a super low-res browser that’s gaining in the developing world (it works on non-smartphones and on slow connections). Webfonts are completely disabled in this browser, so you end up getting an image like
April 5, 2016 at 12:56 pm #184479morriscountynj
Of course, I love webfonts and it took me forever to change lol, but being a gov person, the better accessibility, the better for me π
April 5, 2016 at 8:55 pm #184554Tom
Lead DeveloperLead DeveloperInteresting, thanks for all the input.
I’ll definitely put some thought into it π
April 6, 2016 at 5:34 am #184647morriscountynj
cool π
July 26, 2016 at 7:23 am #213045leungwensen
This project might help if you want to switch from icon fonts to SVG icons with less pain: http://leungwensen.github.io/svg-icon/ It transforms icon fonts collections into SVG icons, supporting almost all the popular icon fonts in github.com, with over 4,000 SVG icons out of the box. You can just select as many icons as you need in the page, and download them as an SVG sprite file. Feel free to leave me an issue if you have any questions using it.
July 26, 2016 at 9:02 am #213080Tom
Lead DeveloperLead DeveloperAwesome, thanks! π
-
AuthorPosts
- You must be logged in to reply to this topic.