Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

cy — vertical center coordinate in SVG

The CSS `cy` property sets the vertical center coordinate of an SVG `circle` or `ellipse`. It accepts a length or a percentage of the current SVG viewport height.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

cy: <length-percentage>;

cy is an SVG geometry property: it sets the vertical center coordinate of a circle or ellipse, not its top edge. It does not position ordinary HTML elements. The horizontal center coordinate is controlled by cx.

The syntax is cy: <length-percentage>;, for example cy: 30px; or cy: 75%;. A percentage refers to the current SVG viewport height, not the shape's height. The initial value is 0, and the property is not inherited. Negative values are allowed and do not by themselves disable rendering of the shape. The property can be animated by computed value.

On circle and ellipse, the cy attribute is a presentation attribute corresponding to the CSS property and participates in the cascade. In the example, the CSS rule overrides cy="20": 75% of the height 120 gives a center coordinate of 90. The example requires local verification in the target browser.

Examples

<!doctype html>
<meta charset="utf-8">
<title>cy</title>
<style>
  circle { cy: 75%; fill: teal; }
</style>
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="120" viewBox="0 0 200 120">
  <circle cx="100" cy="20" r="10" />
</svg>

Result

Expected geometry: center (100, 90), radius 10, within a 200 × 120 SVG viewport.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources