What is the difference between svg\'s x and dx attribute (or y and dy)? When would be a proper time to use the axis shift attribute (dx) versus the location attribute (x)?
x
and y
are absolute coordinates and dx
and dy
are relative coordinates (relative to the specified x
and y
).
In my experience, it is not common to use dx
and dy
on
elements (although it might be useful for coding convenience if you, for example, have some code for positioning text and then separate code for adjusting it).
dx
and dy
are mostly useful when using
elements nested inside a
element to establish fancier multi-line text layouts.
For more details you can check out the Text section of the SVG spec.