Answered
How to create <g> elements in SVG that are recognized as layers in Illustrator
- October 21, 2025
- 1 reply
- 142 views
I’m generating SVG code programmatically, with the intention of editing it later in Adobe Illustrator.
When I create a <g> element with an id attribute, like <g id="item 1"></g>, Illustrator recognizes it as a group named "item 1" within "Layer 1". However, I want Illustrator to recognize it as a separate layer named "item 1", not just a group.
Currently, I’m using an Illustrator script to convert these <g> elements into layers after importing the SVG. But is there a way to write the SVG code so that Illustrator recognizes certain <g> elements as layers from the start?
