Skip to content Skip to sidebar Skip to footer

SVG Text-anchor Setting Makes The Text Element To Move

Hello I am trying to set the text-anchor of an SVG text element. But when I do that, the text elements position is changing. I read its 'x' attribute but it remains same. but getBB

Solution 1:

It sounds like you are misunderstanding how the text-anchor attribute works. It tells the renderer how the text should be positioned relative to the poisition you specify with x and y. If you change it, the position of the text will change relative to x & y.

You can read its definition here: http://www.w3.org/TR/SVG/text.html#AlignmentProperties

How do I reposition the text element?

You use the x and y attributes. You can also use the transform attribute.

is there any method to set the BBox?

No. The bounding box is read-only.


Post a Comment for "SVG Text-anchor Setting Makes The Text Element To Move"