SVG - Ellipse
<ellipse> element is used to draw ellipse with a center point and given two radii.
Declaration
Following is the syntax declaration of <ellipse> element. We've shown main attributes only.
<ellipse cx="x-axis co-ordinate" cy="y-axis co-ordinate" rx="length" ry="length" > </ellipse>
Attributes
| Sr.No. | Name & Description |
|---|---|
| 1 | cx − x-axis co-ordinate of the center of the ellipse. Default is 0. |
| 2 | cy − y-axis co-ordinate of the center of the ellipse. Default is 0. |
| 3 | rx − x-axis radius of the ellipse. |
| 4 | ry − y-axis radius of the ellipse. |
Example
testSVG.htm
<html>
<title>SVG Ellipse</title>
<body>
<h1>Sample SVG Ellipse Image</h1>
<svg width="800" height="800">
<g>
<text x="0" y="15" fill="black" >Ellipse #1: Without opacity.</text>
<ellipse cx="100" cy="100" rx="90" ry="50"
stroke="black" stroke-width="3" fill="rgb(121,0,121)"></ellipse>
</g>
</svg>
</body>
</html>
Output
Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.
Ecllipse with opacity
<html>
<title>SVG Ellipse</title>
<body>
<h1>Sample SVG Ellipse Image</h1>
<svg width="800" height="800">
<g>
<text x="0" y="15" fill="black" >Ellipse #2: With opacity </text>
<ellipse cx="100" cy="100" rx="90" ry="50"
style="fill:rgb(121,0,121);stroke-width:3;
stroke:rgb(0,0,0);stroke-opacity:0.5;opacity:0.5"></ellipse>
</g>
</svg>
</body>
</html>
Output
Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.
svg_shapes.htm
Advertisements