長度調整
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 |
|---|---|
| 預設值 | 間距 |
| 可動畫的 | 是 |
規範
| 規範 |
|---|
| Scalable Vector Graphics (SVG) 2 # TextElementLengthAdjustAttribute |
瀏覽器相容性
svg.elements.text.lengthAdjust
載入中…
svg.elements.tspan.lengthAdjust
載入中…