Open In App

SVG EllipseElement.rx Property

Last Updated : 30 Mar, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

The SVG EllipseElement.rx property Returns an SVGAnimatedLength object corresponding to the attribute of the given ellipse element

Syntax:

EllipseElement.rx

Return value: This property returns SVGAnimatedLength object that can be used get the rx of the Ellipse element

Example 1:

html
<!DOCTYPE html>
<html>

<body>
    <svg width="300" height="300" xmlns="http://www.w3.org/2000/svg">
  <ellipse cx="100" cy="100" rx="60" ry="60" id="ellipse"
      onclick="outputSize();"/>
          <script>
              var g = document.getElementById("ellipse");
              console.log(g.rx)
          </script>
    </svg>
</body>

</html>

Output:

Example 2: 

html
<!DOCTYPE html>
<html>

<body>
    <svg width="300" height="300" xmlns="http://www.w3.org/2000/svg">
  <ellipse cx="100" cy="100" rx="100" ry="60" id="ellipse"
      onclick="outputSize();"/>
          <script>
              var g = document.getElementById("ellipse");
              console.log(g.rx)
          </script>
    </svg>
</body>

</html>

Output:


Explore