The text-anchor
CSS property aligns a box containing a string of text where the wrapping area is determined from the inline-size
property, and the text is then placed relative to the anchor point of the element, which is defined using the x
and y
(or dx
and dy
) attributes. If present, the value of the CSS property overrides any value of the element's text-anchor
attribute.
Each individual text fragment within an element is aligned independently; thus, a multi-line <text>
element will have each line of text aligned as per the value of text-anchor
. text-anchor
values only have an effect on the <text>
, <textPath>
, <tref>
, and <tspan>
SVG elements. text-anchor
does not apply to automatically wrapped text; for that, see text-align
.