← 返回首页
SVGTextContentElement: textLength プロパティ - Web API | MDN

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

SVGTextContentElement: textLength プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.

textLengthSVGTextContentElement インターフェイスの読み取り専用プロパティで、この要素の textLength 属性を反映します。

In this article

SVGAnimatedLength です。

textLength プロパティへのアクセス

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"); // textLength プロパティへのアクセス const animatedLength = textElement.textLength; // textLength 属性の元値 console.log(animatedLength.baseVal.value); // 出力: 100

仕様書

Specification
Scalable Vector Graphics (SVG) 2
# __svg__SVGTextContentElement__textLength

ブラウザーの互換性

Enable JavaScript to view this browser compatibility table.

関連情報