N
N
Nastya2015-09-29 12:31:39
css
Nastya, 2015-09-29 12:31:39

Many svg images in one file for the background - how to set?

I heard that you can save several svg images in one file on different artboards so that there are fewer requests. And in theory, the path to the desired artboard is written quite simply (and not like in png sprites, the lower left corner and percentages ...).
Tell me, who knows how to register the correct path?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Gregory, 2015-09-29
@grigruss

htmlhook.ru/svg-image-sprite.html - !!!
nano.sapegin.ru/all/vyorstka-vektornogo-logotipa-s...
noteskeeper.ru/1061

N
Nastya, 2015-09-30
@fiametta

Grigory , it doesn’t work (
after saving the ai file in svg, I open this svg in the editor. everything seems to be ok, there are <g id="lay01">and so on according to the number of artboards. I insert it as a background:

.p1 {
  background-image:url(../i/patterns_all.svg#lay01);
}

Whatever id I put down, only the first artboard or the one on which (ahem) there was a selection at the time of saving is displayed.
I tried to set classes for each <g id="lay01" class="svgpattern">and registered in styles, as advised in the first link:
.svgpattern { display: none; }
.svgpattern:target { display: inline; }

didn't help (
although I have complex svgs, more than 100 lines of code per 1 object/artboard... Maybe this is the case?
webkit/not webkit - does not affect, does not work anywhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question