web api interface
SVGEllipseElement
The SVGEllipseElement interface provides access to the properties of <ellipse> elements.
Instance properties
Inherits methods from its parent interface, SVGGeometryElement.
cxRead only- : This property returns an
SVGAnimatedLengthreflecting thecxattribute of the given<ellipse>element.
- : This property returns an
cyRead only- : This property returns an
SVGAnimatedLengthreflecting thecyattribute of the given<ellipse>element.
- : This property returns an
rxRead only- : This property returns an
SVGAnimatedLengthreflecting therxattribute of the given<ellipse>element.
- : This property returns an
ryRead only- : This property returns an
SVGAnimatedLengthreflecting theryattribute of the given<ellipse>element.
- : This property returns an
Instance methods
Inherits methods from its parent interface, SVGGeometryElement.
Example
SVG
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
<ellipse cx="100" cy="100" rx="100" ry="60" id="ellipse" />
</svg>
JavaScript
const ellipse = document.getElementById("ellipse");
function outputSize() {
// Outputs "horizontal radius: 100 vertical radius: 60"
console.log(
`horizontal radius: ${ellipse.rx.baseVal.valueAsString}`,
`vertical radius: ${ellipse.ry.baseVal.valueAsString}`,
);
}
ellipse.addEventListener("click", outputSize);
Result
Interactive exampleOpen the canonical MDN source to run this embedded demo.
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
<ellipse>SVG Element