SVG 2 – 15 September 2015 Top ⋅ Contents ⋅ Previous ⋅ Next ⋅ Elements ⋅ Attributes ⋅ Properties

Chapter 6: Geometry Properties

Contents

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’, ‘foreignObject’ and the elements ‘mask’, ‘svg’.

6.1. Horizontal center coordinate: The ‘cx’ property

Name: cx
Value: <length> | <percentage>
Initial: 0
Applies to: ‘circle’ and ‘ellipse’
Inherited: no
Percentages: refer to the size of the current viewport (see Units)
Media: visual
Computed value: absolute length or percentage
Animatable: yes

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

6.2. Vertical center coordinate: The ‘cy’ property

Name: cy
Value: <length> | <percentage>
Initial: 0
Applies to: ‘circle’ and ‘ellipse’
Inherited: no
Percentages: refer to the size of the current viewport (see Units)
Media: visual
Computed value: absolute length or percentage
Animatable: yes

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

6.3. Radius: The ‘r’ property

Name: r
Value: <length> | <percentage>
Initial: 0
Applies to: ‘circle’
Inherited: no
Percentages: refer to the size of the current viewport (see Units)
Media: visual
Computed value: absolute length or percentage
Animatable: yes

The ‘r’ property describes the radius of the ‘circle’ element.

Negative values for ‘r’ are illegal.

6.4. Horizontal radius: The ‘rx’ property

Name: rx
Value: <length> | <percentage>
Initial: 0
Applies to: ‘ellipse’, ‘rect’
Inherited: no
Percentages: refer to the size of the current viewport (see Units)
Media: visual
Computed value: absolute length or percentage
Animatable: yes

The ‘rx’ property describes the horizontal radius of the ‘ellipse’ element and the curve radius of the ‘rect’ element.

Negative values for ‘rx’ are illegal.

6.5. Vertical radius: The ‘ry’ property

Name: ry
Value: <length> | <percentage>
Initial: 0
Applies to: ‘ellipse’, ‘rect’
Inherited: no
Percentages: refer to the size of the current viewport (see Units)
Media: visual
Computed value: absolute length or percentage
Animatable: yes

The ‘ry’ property describes the vertical radius of the ‘ellipse’ element and the curve radius of the ‘rect’ element.

Negative values for ‘ry’ are illegal.

6.6. Horizontal coordinate: The ‘x’ property

Name: x
Value: <length> | <percentage>
Initial: 0
Applies to: ‘mask’, ‘svg’, ‘rect’, ‘image’, ‘foreignObject’
Inherited: no
Percentages: refer to the size of the current viewport (see Units)
Media: visual
Computed value: absolute length or percentage
Animatable: yes

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

6.7. Vertical coordinate: The ‘y’ property

Name: y
Value: <length> | <percentage>
Initial: 0
Applies to: ‘mask’, ‘svg’, ‘rect’, ‘image’, ‘foreignObject’
Inherited: no
Percentages: refer to the size of the current viewport (see Units)
Media: visual
Computed value: absolute length or percentage
Animatable: yes

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

6.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’, ‘mask’, ‘image’ and ‘foreignObject’. All of these elements have ‘width’ and ‘height’ presentation attributes.

The value auto for ‘width’ and ‘height’ on these elements must compute to 0.

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

SVG 2 – 15 September 2015 Top ⋅ Contents ⋅ Previous ⋅ Next ⋅ Elements ⋅ Attributes ⋅ Properties