« SVG Attribute reference home

For the <circle> and the <ellipse> elements, this attribute defines the x-coordinate of the center of the element. If unspecified, the effect is as if the value is set to "0".

For the <radialGradient> element, this attribute defines the x-coordinate of the largest (i.e., outermost) circle for the radial gradient. The gradient will be drawn such that 100% gradient stop is mapped to the perimeter of the largest (i.e. outermost) circle. If the attribute is not specified, the effect is as if a value of 50% were set.

Usage context


A <coordinate> is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for X coordinates, the y-axis for Y coordinates). Its syntax is the same as that for <length>.

Within the SVG DOM, a <coordinate> is represented as an SVGLength or an SVGAnimatedLength.


SVG 'cx' attribute example

HTML Content

<svg viewBox="0 0 500 100">
  <circle cy="50" r="25"/> <!-- This circle will appear cut off (cx=0) -->
  <circle cx="150" cy="50" r="25"/>
  <circle cx="350" cy="50" r="25"/>



The following elements can use the cx attribute

Browser compatibilityUpdate compatibility data on GitHub

Chrome Edge Firefox Internet Explorer Opera Safari
Basic support ? ? ? ? ? ?
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support ? ? ? ? ? ? ?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.