G
G
Good Man2016-09-09 17:14:20
Adobe Illustrator
Good Man, 2016-09-09 17:14:20

Creating and using SVG sprites?

Good afternoon colleagues!
I decided to dive a little into svg sprites.
I created a new file in Illustrator, sketched icons from the svg layout, then exported "export as" gave the name sprite.svg. Then I chose the following settings: 5b1b0f33de284827823eefb5a68058d8.png
And I tried to connect and display one of the icons through background-image.
it turned out like this: I 8b264e58ba6642d28c35b9347d01df4f.png
connected it in the markup, hoping to get the instagram icon:

<object type="image/svg+xml" width="100" height="100" data="/img/sprite.svg#instagram"></object>

which gave the same result as above on the screen.
As I understand it, I'm not creating a sprite correctly, or saving it. Help me with good advice, how to make it so that when specified through background-position: 20px 20px; exactly what is located at these coordinates was shown and the id binding worked as in the above code.
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Violetta Morozova, 2016-09-16
@AtriSimone

We connect svg sprites through background in css, and not through object. (we work through TARS)
Read this article, maybe it will help you someday https://svgontheweb.com/ru/ CSS-manipulation point, look and be sure to point Sprites. I think there is what you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question