CKTIS / CSS
CSS property `r`
The SVG geometry property `r` sets the radius of a `<circle>`; a CSS declaration participates in the cascade with the presentation attribute and can override it.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<length-percentage [0,∞]>The SVG geometry property r sets the radius of a <circle>; a CSS declaration participates in the cascade with the presentation attribute and can override it.
The example compares three diameters: r:20px yields 40 px, r:calc(-5px) clamps to zero, and invalid r:-5px is discarded so the r="7" attribute wins and yields 14 px.
Grammar: <length-percentage [0,∞]>.
A literal negative value is out of range and invalidates the declaration, while a negative math-function result clamps to 0; a zero radius does not paint a circle. A percentage refers to the SVG viewport’s normalized diagonal, not just its width or height. The property applies to <circle>; <ellipse> uses separate radii.
Examples
<!doctype html><meta charset="utf-8"><svg width="180" height="100"><circle id="styled" cx="40" cy="50" r="5" style="r:20px"/><circle id="clamped" cx="90" cy="50" style="r:calc(-5px)"/><circle id="invalid" cx="140" cy="50" r="7" style="r:-5px"/></svg><pre id="result"></pre><script>const box=e=>Math.round(e.getBBox().width),a=box(styled),b=box(clamped),c=box(invalid),x=getComputedStyle(styled).r,y=getComputedStyle(clamped).r,z=getComputedStyle(invalid).r;if(a!==40||b!==0||c!==14||x!=='20px'||y!=='0px'||z!=='7px')throw new Error('r mismatch '+[a,b,c,x,y,z]);result.textContent='diameters='+[a,b,c].join('/')+'; computed='+[x,y,z].join('/');</script>Result
diameters=40/0/14; computed=20px/0px/7px
The example compares three diameters: `r:20px` yields 40 px, `r:calc(-5px)` clamps to zero, and invalid `r:-5px` is discarded so the `r="7"` attribute wins and yields 14 px.