Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which svg elements can be child, and which cant be

Tags:

svg

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.

like image 945
Rajkamal Subramanian Avatar asked Feb 10 '12 11:02

Rajkamal Subramanian


People also ask

Can an SVG be a child of an SVG?

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.

What is the child of an SVG?

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.

What elements can go in an SVG?

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).

Can svgs be nested?

The SVG format allows for the nesting of SVG graphics. It is possible for an “<svg>” elements, to be placed within another “<svg>” element.


1 Answers

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>
like image 105
Robert Longson Avatar answered Dec 15 '22 19:12

Robert Longson