text-anchor

An SVG-specific property used to align a string of text relative to its starting point. It's essentially 'text-align' but for text elements inside an <svg>.

It is documented as part of the Scalable Vector Graphics specification.

/* Usage Example */
text.label {
  /* Aligns the center of the text string to the X coordinate provided */
  text-anchor: middle;
}

/* Syntax */
text-anchor: start;
text-anchor: middle;
text-anchor: end;

/* Global values */
text-anchor: inherit;
text-anchor: initial;
text-anchor: revert;
text-anchor: revert-layer;
text-anchor: unset;
Widely available Since 2020 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2020.

1+
3+
4+
14+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC