139
SVG defs Element
The SVG <defs> element is used to embed definitions that can be reused inside an SVG image.
Using the SVG <defs> elements you can group SVG shapes together and reuse them as a single shape.
The shapes defined inside the <defs> element will be displayed when you reference it by a <use> element.
Example
Explanation
- The id attribute of <g> defines a unique name.
- The <use> element references the <g> element through its xlink:href attribute.
- The # symbol defines the attribute value.
- The <use> element is used to specify that where to show the reused shapes via its x and y attributes.
Next TopicSVG Symbol Element