I have around 30 PNG icons which I want to embed in my D3.js graphic within an SVG element. Up to now I have been loading all images(pngs) separately.
goal: Now i want to use one sprite instead. How can I do this in the best way?
I converted my icons in a sprite by using some free online sprite creator and got additionaly to my sprite a css code wich looks like this:
container li {
background: url("../images/somePng.png") no-repeat top left;
}
.sprite-icon_1{ background-position: 0 0; width: 40px; height: 40px; }
.sprite-icon_2{ background-position: 0 -90px; width: 40px; height: 40px; }
... ... ...
.sprite-icon_3{ background-position: 0 -180px; width: 40px; height: 40px; }
I really tried to find information about that in the web but could not find a suitable way. I don't care about how to get to the goal, as long as i don't have to type the position coordinates myself, it needs to much time or the images have a different positioning/scaling behavior than normal separately loaded svg-image elements.
I am thankful for all help!