I'd like to add a border to a number of elements which are grouped by <g>
. As an example:
<g id="group">
<circle cx="125" cy="125" r="65" fill="orange" />
<line x1="50" y1="50" x2="200" y2="200" stroke="blue" stroke-width="4" />
</g>
Best case, the border should look like in the following picture. The distance between the elements and the border is not required (but nice to have). The main goal should be a single border (stroke) around the group elements.
I found the picture in a tutorial, but there it was just to demonstrate what a group of elements may look like. So this doesn't help.
I already tried different solutions, but none of them worked as expected, e.g.
- A SVG filter using feColorMatrix and feMorphology (see this post). But in this case, the color of the elements changes when applying the filter.
- Styling the
<g>
withstroke
andstroke-width
results in a rectangular border around the group, which is also not the thing I want.
Any ideas, how to get a border around the group as shown in the picture?