みさご解体新書

SVGテキスト

揃え位置

AAA BBB CCC
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" version="1.1">
  <line x1="100" y1="0" x2="100" y2="200" stroke="#666" />
  <text x="100" y="60" text-anchor="start" fill="#fff">AAA</text>
  <text x="100" y="110" text-anchor="middle" fill="#fff">BBB</text>
  <text x="100" y="160" text-anchor="end" fill="#fff">CCC</text>
</svg>
揃え位置 text-anchor
左揃え start
中央揃え middle
右揃え end