CKTIS / CSS
rx — horizontal radius in SVG
The CSS `rx` property sets the horizontal radius of an SVG ellipse or the horizontal corner radius of an SVG rectangle. It accepts a length, a percentage, or `auto` and works together with `ry`.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
rx: <length-percentage> | auto;rx applies to SVG ellipse and rect elements, not ordinary HTML boxes. For ellipse, it sets the horizontal radius; for rect, the horizontal corner radius. Its vertical counterpart is ry. The property is not inherited.
The syntax is rx: <length-percentage> | auto;. A percentage refers to the current SVG viewport width, not the shape's width. The initial auto takes its radius from ry; when both are auto, the used radius is 0. Negative values are invalid; the consulted SVG 2 draft describes treating them as auto.
For rect, the used rx cannot exceed half the shape's width. A zero corner radius produces square corners; a zero ellipse radius prevents the ellipse from rendering. This is SVG geometry, not a replacement for HTML border-radius.
You can specify rx using a CSS declaration or its corresponding SVG presentation attribute. The example uses CSS and an explicit ry to demonstrate the two radii separately. Specification behavior does not confirm browser support for every case; the example requires local verification.
Examples
<!doctype html>
<meta charset="utf-8">
<title>rx</title>
<style>
rect { rx: 20px; ry: 10px; fill: navy; }
</style>
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" viewBox="0 0 200 100">
<rect x="20" y="20" width="160" height="60" />
</svg>Result
A navy 160 × 60 rectangle at (20, 20), with horizontal corner radius 20 and vertical corner radius 10, inside a 200 × 100 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.