SVGTextPositioningElement: y Eigenschaft - Web-APIs | MDN

Wert

Eine SVGAnimatedLengthList.

Beispiele

Gegeben das folgende SVG:

html

<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
  <text x="10" y="20">Hello</text>
  <text x="50" y="50">World</text>
</svg>

Wir können auf die berechneten Werte der y-Attribute zugreifen:

js

const texts = document.querySelectorAll("text");

console.log(texts[0].y.baseVal[0].value); // output: 20
console.log(texts[1].y.baseVal[0].value); // output: 50

Spezifikationen

Spezifikation
Scalable Vector Graphics (SVG) 2
# __svg__SVGTextPositioningElement__y

Browser-Kompatibilität

Siehe auch

Help improve MDN

Erfahren Sie, wie Sie beitragen können Diese Seite wurde automatisch aus dem Englischen übersetzt.