lengthAdjust

lengthAdjust 屬性控制文字如何拉伸到 textLength 屬性定義的長度。

您可以將此屬性與以下 SVG 元素一起使用

示例

html
<svg width="300" height="150" xmlns="http://www.w3.org/2000/svg">
  <g font-face="sans-serif">
    <text x="0" y="20" textLength="300" lengthAdjust="spacing">
      Stretched using spacing only.
    </text>
    <text x="0" y="50" textLength="300" lengthAdjust="spacingAndGlyphs">
      Stretched using spacing and glyphs.
    </text>
    <text x="0" y="80" textLength="100" lengthAdjust="spacing">
      Shrunk using spacing only.
    </text>
    <text x="0" y="110" textLength="100" lengthAdjust="spacingAndGlyphs">
      Shrunk using spacing and glyphs.
    </text>
  </g>
</svg>

用法說明

spacing | spacingAndGlyphs
預設值 spacing
可動畫

規範

規範
可縮放向量圖形 (SVG) 2
# TextElementLengthAdjustAttribute

瀏覽器相容性

BCD 表格僅在啟用 JavaScript 的瀏覽器中載入。