Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating one shape inside another

Tags:

svg

We can create shapes like rectangle, circle etc. Can we create a rectangle inside another rectangle?

like image 846
Pradeep Neo Avatar asked Apr 27 '11 05:04

Pradeep Neo


People also ask

How do I paste a shape inside another shape in Illustrator?

Select an object, CONTROL C to copy it, then either Control V to paste it to center of artboard, or Control F to paste directly over and in front of the original.

How do you unite an object in Illustrator?

Combining the shapes 1 Using the Selection tool ( ), click on the triangle shape if it is not selected, then Shift+click on the ellipse. 2 Select the Shape Builder tool ( ) in the Tools panel. Click and drag from one shape to another. The triangle and ellipse are combined into one shape.

How do I combine one shape in Illustrator?

Select all the shapes using the “Selection Tool”. While all the shapes are selected, select the “Pathfinder Tool” (displayed below in red). Now select the “Unite” selection (displayed below in green). Your shapes should now be combined to form a single shape.


1 Answers

You can't create a rectangle inside an other rectangle. But you can make 2 rectangles to look so.

You use the <rect> tag for rectangles. By looking at the rectangle description in the specifications, you can see that the content model don't allow <rect> to contain an other <rect> (or shape).

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 a <g> around those two rectangles to group them, like this :

<g>
    <rect x="0" y="0" width="200" height="100"/>
    <rect x="25" y="25" width="150" height="50"/>
</g>

More explanations here : http://www.w3.org/TR/SVG/struct.html#Groups

You also have the alternative of using a path to draw 2 rectangles with only one tag. It all depend of your needs.

like image 175
Planplan Avatar answered Sep 20 '22 21:09

Planplan