files/en-us/web/api/svgrectelement/x/index.md
{{APIRef("SVG")}}
The x read-only property of the {{domxref("SVGRectElement")}} interface describes the horizontal coordinate of the position of an SVG rectangle as a {{domxref("SVGAnimatedLength")}}. The <coordinate> is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the x-axis. Its syntax is the same as that for <length>.
It reflects the {{SVGElement("rect")}} element's {{SVGAttr("x")}} geometric attribute value. The CSS {{cssxref("x")}} property takes precedence over the SVG x geometric attribute, so the value may not reflect the element's appearance. The default value is 0.
An {{domxref("SVGAnimatedLength")}}.
const rectangle = document.querySelector("rect");
const leftPosition = rectangle.x;
console.log(leftPosition.baseVal.value); // the `x` value
{{Specifications}}
{{Compat}}