SVGTextPositioningElement: dx-Eigenschaft
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Die dx
-Eigenschaft der SVGTextPositioningElement
-Schnittstelle, die nur lesbar ist, beschreibt die x-Achsen-Koordinate des SVGTextElement
, SVGTSpanElement
oder SVGTRefElement
als SVGAnimatedLengthList
. Sie spiegelt die horizontale Verschiebung der einzelnen Textzeichen im Benutzerkoordinatensystem des dx
-Attributs wider.
Der Attributwert ist eine Liste von <length>
, <percentage>
oder <number>
. Die numerischen Werte in SVGAnimatedLengthList.baseVal
spiegeln die horizontalen Verschiebungen im Benutzerkoordinatensystem wider.
Wert
Eine SVGAnimatedLengthList
.
Beispiele
Für das folgende SVG:
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<text x="10" y="20" dx="5">Hello</text>
<text x="50" y="50" dx="10">World</text>
</svg>
Können wir auf die berechneten Werte der dx
-Attribute zugreifen:
const texts = document.querySelectorAll("text");
console.log(texts[0].dx.baseVal[0].value); // output: 5
console.log(texts[1].dx.baseVal[0].value); // output: 10
Spezifikationen
Specification |
---|
Scalable Vector Graphics (SVG) 2 # __svg__SVGTextPositioningElement__dx |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
dx |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support