O'Reilly logo

Designing SVG Web Graphics by Andrew H. Watt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The <ellipse> Element

An ellipse, geometrically speaking, is simply a circle where the radius in the x direction and the radius in the y direction differ. If the radii are the same, the curved graphic element is a circle. In SVG, you can represent a circle by using either a <circle> element or an <ellipse> element with the x and y radii being equal.

A simple ellipse shape would have SVG source code like this:

Listing 3.13. (SimpleEllipse01.svg)
<?xml version="1.0" standalone="no"?> 
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" 
      "http://www.w3.org/TR/2001/PR-SVG-20010719/ 
       DTD/svg10.dtd"> 
<svg width="250" height="150"> 
<ellipse cx="80" cy="70" rx="35" ry="10" 
style="stroke:red; fill:#CCCCCC"/> 
</svg> 

The cx and cy attributes define the position ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required