I am relatively new in SVG drawing with HTML5.
What I want to do is to make a group of elements in SVG with g element so that all elements inside of that g element can work like a group and all the element's base x and y value can be received from the upper g element.
So, what I have done is something like this-
<svg width=500 height=300 xmlns=http://www.w3.org/2000/svg>
<g x=1000 y=1000>
<title>SVG Title Demo example</title>
<rect width=200 height=50
style=fill:wheat; stroke:blue; stroke-width:1px/>
<text style=text-anchor: middle; class=small>My Text</text>
</g>
</svg>
What I expected is all the elements inside the g element will get x=1000
and y=1000
so my expected output is like this-
But I am getting this-
Re-
I don't like to set x and y element in text
element. I just want to set relative x and y into the text
element if needed, but that should be relative to g element.
Can anyone help me what I need to do to achieve my target with a group in SVG?