SVGSVGElement: y-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 y schreibgeschützte Eigenschaft der SVGSVGElement-Schnittstelle beschreibt die vertikale Koordinate der Position des SVG-Elements als ein SVGAnimatedLength. Wenn ein <svg> in einem anderen <svg> verschachtelt ist, ist die vertikale Koordinate eine Länge im Benutzerkoordinatensystem, die den angegebenen Abstand vom Ursprung des Benutzerkoordinatensystems entlang der y-Achse darstellt. Die Syntax ist identisch mit der für <length>.

Sie spiegelt das geometrische Attribut y des <svg>-Elements wider. Der Standardwert ist 0. Das y-Attribut hat keine Wirkung auf äußerste <svg>-Elemente, sondern nur auf verschachtelte. Die CSS-Eigenschaft y hat Vorrang vor dem y-Attribut des <svg>-Elements, sodass der Wert möglicherweise nicht das Erscheinungsbild des Elements widerspiegelt.

Wert

Beispiel

js
const svg = document.querySelector("svg");
const topPosition = svg.y;
console.dir(leftPosition.baseVal.value); // the `y` value

Spezifikationen

Specification
Scalable Vector Graphics (SVG) 2
# __svg__SVGSVGElement__y

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
y

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Siehe auch