长度调整
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
加载中…