In html we say, the inline elements should be within the block elements. Similiarly, is there any rule that i can use, to find out which svg elements can be child, and which cant be.
An SVG document fragment can consist of a stand-alone SVG document, or a fragment of a parent document enclosed by an 'svg' element. Howevere, an 'svg' element that is a direct child of another SVG-namespaced element is not the root of an SVG document fragment. Any element in the SVG namespace.
SVG files can be made of many individual shapes. Each of these shapes (called a "child") has its own name that can be used to extract it from the "parent" file. This example loads a map of the United States and creates two new PShape objects by extracting the data from two states.
There are 7 shape elements in SVG: <circle> , <ellipse> , <line> , <path> , <polygon> , <polyline> , and <rect> . For <path> , <polygon> , and <polyline> , the determination of whether an area is inside or outside the shape is affected by the fill-rule style property (or clip-rule withing clipping paths).
The SVG format allows for the nesting of SVG graphics. It is possible for an “<svg>” elements, to be placed within another “<svg>” element.
Containers that can contain graphics children are container elements:
[A container element] can have graphics elements and other container elements as child elements.
Specifically: ‘a’, ‘defs’, ‘glyph’, ‘g’, ‘marker’, ‘mask’, ‘missing-glyph’, ‘pattern’, ‘svg’, ‘switch’ and ‘symbol’.
Any element can have a non graphical child though e.g.
<rect>
<title>what the rect is</title>
</rect>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With