SVGTextContentElement: lengthAdjust 屬性

Baseline 已廣泛支援

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2015 年 7 月⁩以來,各瀏覽器均已提供此特性。

SVGTextContentElement 介面的只讀屬性 lengthAdjust 反映了給定元素的 lengthAdjust 屬性。它接受該介面上定義的 LENGTHADJUST_* 常量之一。

一個 SVGAnimatedEnumeration

示例

訪問 lengthAdjust 屬性

html
<svg width="200" height="100">
  <text id="myText" x="10" y="50" textLength="100" lengthAdjust="spacing">
    Hello, SVG!
  </text>
</svg>
js
const textElement = document.getElementById("myText");

// Access the `lengthAdjust` property
const lengthAdjust = textElement.lengthAdjust;

// Log the base value of the `lengthAdjust` attribute
console.log(lengthAdjust.baseVal); // Output: 1 (e.g. LENGTHADJUST_SPACING)

規範

規範
Scalable Vector Graphics (SVG) 2
# __svg__SVGTextContentElement__lengthAdjust

瀏覽器相容性

另見