SVG
The height read-only property of the SVGRectElement interface describes the vertical size of an SVG rectangle as a SVGAnimatedLength. The length is in user coordinate system units along the y-axis. Its syntax is the same as that for <length>.
It reflects the rect element's height presentational attribute. The CSS height property takes precedence over the SVG height presentational attribute, so the value may not reflect the elements actual size. The default value is 0.
Value
An SVGAnimatedLength.
Example
const rectangle = document.querySelector("rect");
const rectHeight = rectangle.height;
console.log(rectHeight.baseVal.value); // the `height` value
Specifications
Browser compatibility
See also
- DOMRect.height
- SVGRectElement.width
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
