3

Is there a way to export an .svg sprite directly from Illustrator, with a separate viewBox for each element?

I am only able get one viewBox for the whole set of icons, even when each of them is on its own artboard.

3
  • is it even possible to have multiple viewBoxes per svg file?
    – Luciano
    Jul 6, 2016 at 14:17
  • 1
    You could always use the Export For Screens option to export each artboard as its own SVG
    – Manly
    Jul 6, 2016 at 14:27
  • @Luciano turns out it is! (I posted the answer below.)
    – Ilze
    Jul 6, 2016 at 14:31

1 Answer 1

4

I seem to have found the solution - each sprite element must be converted to a symbol. That creates a viewBox for each symbol when exporting the svg.

An example:

<symbol id="badminton" data-name="badminton" viewBox="0 0 33.84 40.41">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.