004 Continuous Corners
递进式圆角与连续曲率圆角
嵌套圆角怎样逐层计算,以及什么时候改用连续曲率圆角,让卡片和表单的转角更规整。
一张圆角 16px、内边距 8px 的卡片,里面的按钮也用 16px 圆角,转角处两条边框的间距就会比直边处宽,按钮看起来没有贴合卡片;较大的圆角接直边的地方,还会有一道折痕。做法有以下四条:
- 等距内缩:用于表单、嵌套卡片、弹窗这类有内外两层圆角的地方。每一层都按「内圆角 = 外圆角 − 间距」计算,内外共用一个圆心,转角处的间距才和直边处相同。卡片圆角 16、内边距 8,里面的按钮圆角就是 8。
- 多层嵌套:三层及以上时,由外向内逐层计算。弹窗圆角 32、内边距 16,内部面板和按钮为 16;面板里再缩进 8 放一个标签,标签为 8。同一层级的元素共用一个圆角,最小不低于 4。
- 胶囊和圆形:嵌套在容器里的胶囊形和圆形元素不参与计算,始终保持完全圆形。
- 连续曲率圆角:用于圆角较大、连接处能看出折痕,或想要接近 iOS 圆角观感的情况。普通圆角在接直边处曲率突然变化,连续曲率圆角(超椭圆)让曲率逐渐增大,过渡更顺。写法是
border-radius: 32px; corner-shape: superellipse(1.25);
另外,corner-shape 目前只有 Chrome 和 Edge 139 及以上版本支持;Safari 和 Firefox 会自动退回普通圆角,不需要额外处理。
附带的 Prompt 会由外向内重新计算你指定界面的圆角;项目里有圆角 token 时,直接修改 token。
Make the corner radii in this UI consistent, then switch them to continuous
corners. Work on the screen or components I name; ask me if I have not
named them. If the project has radius tokens, change those instead of
hard-coding values.
1. Inner radius = outer radius - padding (r = R - p)
- Go from the outside in: dialog or card -> panels, inputs, buttons ->
chips and tags. A box p inside a container with radius R gets R - p,
so both corners share one center. Example: dialog 32, padding 16 ->
panels and buttons 16; a chip 8 inside a 16 panel -> 8.
- Boxes on the same level share one radius. Never go below 4.
- Pills and circles stay fully round.
- Keep every padding, gap and radius on a 4px grid.
2. Continuous corners
- Keep border-radius and add the curve as progressive enhancement:
@supports (corner-shape: superellipse(1.25)) {
:where(*) { corner-shape: superellipse(1.25); }
}
Set corner-shape: round on pills and circles.
- Chrome and Edge 139+ render it; Safari and Firefox skip the block and
show the plain border-radius.
When done, list every radius you changed as "element: old -> new".




















