Home

Squeezing SVG text with textLength

textLength sets how wide an SVG <text> element should be. lengthAdjust says how to get there: spacing only changes the gaps between letters, spacingAndGlyphs narrows the letters too.

<text
  x="59"
  y="19.5"
  text-anchor="middle"
  textLength="52"
  lengthAdjust="spacingAndGlyphs"
>
  no cookies
</text>

Only set it when the text is too long. On a short label it stretches the letters apart instead, which looks worse than you’d expect.

preview: palette · effects

starglow theme options · this tab only