CKTIS / CSS
circle() — circular basic shape
`circle()` describes a circle using one radius and an optional `at` center, resolved in the coordinate system of the reference box.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
circle( <radial-size>? [ at <position> ]? )circle() describes a circle using one radius and an optional at center, resolved in the coordinate system of the reference box.
The example uses clip-path: circle(30px at 40px 50px) on a 120 by 100 pixel box. Hit testing accepts the center and a point 29px away, but rejects a point 31px away and the corner—observable geometry from a real clipping shape.
Grammar: circle( <radial-size>? [ at <position> ]? ).
The radius accepts one <length-percentage> or one of four keywords: closest-side, farthest-side, closest-corner, or farthest-corner; two radius values are invalid. A percentage radius is relative to the reference box’s direction-agnostic size, which is its diagonal length divided by the square root of two. An omitted radius defaults to closest-side, and an omitted position to center. In shape-outside the shape changes a float’s wrapping area, while in clip-path it restricts painting and pointer hit testing to the circle’s interior.
Examples
const box=document.createElement('div');document.body.append(box);box.style.cssText='position:absolute;left:20px;top:20px;width:120px;height:100px;background:black;clip-path:circle(30px at 40px 50px)';const rect=box.getBoundingClientRect(),computed=getComputedStyle(box).clipPath;const hit=(x,y)=>document.elementFromPoint(rect.left+x,rect.top+y)===box;const center=hit(40,50),inside=hit(69,50),outside=hit(71,50),corner=hit(0,0);if(computed!=='circle(30px at 40px 50px)'||!center||!inside||outside||corner)throw new Error('circle geometry/hit-test mismatch: '+[computed,center,inside,outside,corner]);console.log('computed='+computed+'; center='+center+'; r29='+inside+'; r31='+outside+'; corner='+corner);Result
computed=circle(30px at 40px 50px); center=true; r29=true; r31=false; corner=false
`circle()` describes a circle using one radius and an optional `at` center, resolved in the coordinate system of the reference box.