# Chapter 7: Geometry Properties

Beside SVG's styling properties, SVG also defines geometry properties. Geometry properties describe the position and dimension of the graphics elements circle, ellipse, rect, image, and the svg element.

## 7.1. Horizontal center coordinate: The ‘cx’ property

Name: cx 0 ‘circle’ and ‘ellipse’ elements no refer to the width of the current SVG viewport (see Units) visual an absolute length or percentage by computed value

The cx property describes the horizontal center coordinate of the position of the element.

## 7.2. Vertical center coordinate: The ‘cy’ property

Name: cy 0 ‘circle’ and ‘ellipse’ elements no refer to the height of the current SVG viewport (see Units) visual an absolute length or percentage by computed value

The cy property describes the vertical center coordinate of the position of the element.

## 7.3. Radius: The ‘r’ property

Name: r 0 ‘circle’ element no refer to the normalized diagonal of the current SVG viewport (see Units) visual an absolute length or percentage by computed value

The r property describes the radius of the circle element.

A negative value for r is invalid and must be ignored.

## 7.4. Horizontal radius: The ‘rx’ property

Name: rx | auto auto ‘ellipse’, ‘rect’ elements no refer to the width of the current SVG viewport (see Units) visual an absolute length or percentage by computed value

The rx property describes the horizontal radius of the ellipse element and the curve radius of the rect element. When the computed value of ‘rx’ is auto, the used radius is equal to the absolute length used for ry, creating a circular arc. If both ‘rx’ and ‘ry’ have a computed value of auto, the used value is 0.

Regardless of how the value is calculated, the used value of ‘rx’ for a rect is never more than 50% of the used value of width for the same shape.

The auto behavior is new in SVG 2 for ellipse, matching the behavior for rect elements when rx was not specified.

A negative value for rx is invalid and must be ignored.

## 7.5. Vertical radius: The ‘ry’ property

Name: ry | auto auto ‘ellipse’, ‘rect’ no refer to the height of the current SVG viewport (see Units) visual an absolute length or percentage by computed value

The ry property describes the vertical radius of the ellipse element and the vertical curve radius of the rect element. When the computed value of ‘ry’ is auto, the used radius is equal to the absolute length used for rx, creating a circular arc. If both ‘rx’ and ‘ry’ have a computed value of auto, the used value is 0.

Regardless of how the value is calculated, the used value of ‘ry’ for a rect is never more than 50% of the used value of height for the same shape.

The auto behavior is new in SVG 2 for ellipse, matching the behavior for rect elements when ry was not specified.

A negative value for ry is invalid and must be ignored.

## 7.6. Horizontal coordinate: The ‘x’ property

Name: x 0 ‘svg’, ‘rect’, ‘image’, elements no refer to the width of the current SVG viewport (see Units) visual an absolute length or percentage by computed value

The x property describes the horizontal coordinate of the position of the element.

## 7.7. Vertical coordinate: The ‘y’ property

Name: y 0 ‘svg’, ‘rect’, ‘image’, elements no refer to the height of the current SVG viewport (see Units) visual an absolute length or percentage by computed value

The y property describes the vertical coordinate of the position of the element.

## 7.8. Sizing properties: the effect of the ‘width’ and ‘height’ properties

See the CSS 2.1 specification for the definitions of width and height.

The CSS width and height properties are used for sizing some SVG elements. Specifically, they are used to size rect, svg, image and . All of these elements have ‘width’ and ‘height’ presentation attributes. The properties are also used for laying out embedded elements from the HTML namespace.

The used value of width may be constrained by the value of the max-width and min-width properties. The used value of height may be constrained by the value of the max-height and min-height properties.

The value auto for width and height on the svg element is treated as 100%.

The value auto for width and height on the image element is calculated from the referenced image's intrinsic dimensions and aspect ratio, according to the CSS Default Sizing Algorithm.

New in SVG 2. Images embedded in SVG can now be auto-sized to the intrinsic size, or scaled to a fixed height or width according to the intrinsic aspect ratio. This matches the behavior of embedded images in HTML.

The value auto for width and height on other elements is treated as 0.

This means that, for example, a object element will not shrink-wrap to its contents if auto is used.