You cannot create a rectangle inside another rectangle. But you can make 2 rectangles to look like this.
You are using the <rect> tag for rectangles. After examining the description of the rectangle in the specifications , you can see that the content model does not allow <rect> to contain another <rect> (or form).
An example of what you can do:
<rect x="0" y="0" width="200" height="100"/> <rect x="25" y="25" width="150" height="50"/>
You can also add <g> around these two rectangles to group them, for example:
<g> <rect x="0" y="0" width="200" height="100"/> <rect x="25" y="25" width="150" height="50"/> </g>
Further explanation here: http://www.w3.org/TR/SVG/struct.html#Groups
You also have an alternative to using a path to draw 2 rectangles with just one tag. It all depends on your needs.
source share