Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

How to create SVG sprites with fallback png?

I'm creating icon svg sprites for mobile, but somehow in iOS some of the images don't appear. And also I want to know how to create png fallback with sprites.

I write the scss like this:

.icon {

@include background(image-url('icon_svg.svg') no-repeat);
display: block;
text-indent: -9999px;
&.blog_logo {
    width: 190px;
    height: 35px;
    background-position: 0 0px;
}
&.blog_nav {
    width: 22px;
    height: 18px;
    background-position: 0 -37px;
}
&.blog_search {
    width: 18px;
    height: 21px;
    background-position: 0 -60px;
}
&.flower {
    width: 41px;
    height: 29px;
    background-position: 0 -84px;
    margin: 0 auto;
}

}

-> but somehow, only the .blog_log and .flower don't show in iOS

Can anyone help me?

1 Answer

If it is a monotoned svg image... I have found http://iconvau.lt to be handy...
It allows you to turn your SVG asset into a font set.