Quantcast
Channel: professional website design » Filter
Viewing all articles
Browse latest Browse all 224

How to Implement Cross-Browser SVG Sprites

$
0
0
In this tutorial I’m going to demonstrate a basic implementation of some SVG icons, how to provide a fallback, and how to turn them into an SVG sprite. Basic SVG Implementation For the purpose of this tutorial I’m going to be using a single page, which will act as a kind of online business card. It will briefly introduce me and display three network profiles relevant to my work. I cons from flaticon From the screenshot above you can see that I’m using icons (for Twitter, Dribbble and GitHub) to symbolically reference my network profiles. I downloaded these icons from flaticon , which has a wide range of icons & symbols in both vector and raster formats.  PNG and SVG We’re going to begin by using the PNG versions of these icons, for the sake of backward compatibility, then we’ll prepare the SVG versions to use in supporting browsers. I used Sketch to output my PNG icons, so I’m going to use it again to prepare my icons for SVG usage. If you look at the screenshot above you’ll notice that I’ve named all my groups and shapes in the left hand panel appropriately (Adobe Illustrator has a similar view in the Layers panel). It’s important to name all your assets correctly, not only to help you remain organised but also for what we’ll be using them for later in this tutorial.  Exporting SVGs Now I’ll export the icons as SVGs, which is straightforward with the slicing tool in Sketch. For more information on how this works take a look at  Understanding Sketch’s Export Options . I’ll be exporting them as separate files and placing them into the images directory of my project.

Viewing all articles
Browse latest Browse all 224

Trending Articles