
Arc shape with rounded edges
5/20/25About 2 minCSSArticle(s)blogcss-tip.comcss
Arc shape with rounded edges 관련
CSS > Article(s)
Article(s)
Previously, I used CSS mask to create an arc shape with rounded edges. Now, we can rely on the new shape() function that produces a more compact code and gives better rendering. A single-element implementation optimized with CSS variables.

@property --_f {
syntax: "<number>";
inherits: false;
initial-value: 0;
}
.arc {
--v: 35; /* [0 100] */
--b: 40px; /* thickness */
--_v: min(99.99,var(--v));
--_f: round(down,var(--_v),50);
--_c: if(style(--_f: 0): small; else: large);
aspect-ratio: 1;
clip-path: shape(from top,
arc to calc(50% + 50%*sin(var(--_v)*3.6deg))
calc(50% - 50%*cos(var(--_v)*3.6deg)) of 50% var(--_c) cw,
arc to calc(50% + (50% - var(--b))*sin(var(--_v)*3.6deg))
calc(50% - (50% - var(--b))*cos(var(--_v)*3.6deg)) of 1% cw,
arc to 50% var(--b) of calc(50% - var(--b)) var(--_c),
arc to top of 1% cw
);
}
See Arc shape with rounded edges by t_afif on CodePen.
Another implementation using styles queries instead of inline conditions:
@property --_f {
syntax: "<number>";
inherits: false;
initial-value: 0;
}
.arc {
--v: 35; /* [0 100] */
--b: 40px; /* thickness */
--_v: min(99.99,var(--v));
--_f: round(down,var(--_v),50);
aspect-ratio: 1;
display: grid;
container-name: arc;
}
.arc:before {
content: "";
clip-path: shape(from top,
arc to calc(50% + 50%*sin(var(--_v)*3.6deg))
calc(50% - 50%*cos(var(--_v)*3.6deg)) of 50% var(--_c,large) cw,
arc to calc(50% + (50% - var(--b))*sin(var(--_v)*3.6deg))
calc(50% - (50% - var(--b))*cos(var(--_v)*3.6deg)) of 1% cw,
arc to 50% var(--b) of calc(50% - var(--b)) var(--_c,large),
arc to top of 1% cw
);
@container style(--_f: 0) {--_c: small}
}
See Arc shape with rounded edges by t_afif on CodePen.
And a demo with a starting animation
More CSS Tips

Safe align your content
Learn about the keyword ”safe” and how to use it

How to correctly use if() in CSS
Learn how to easily fix an issue you will face when using if()

Blob shape with hover effect
Add a blob shape to your image with a cool bouncy hover effect

A heart shape with modern CSS
Use the new shape() function to create a heart shape with minimal code

Arc shape with rounded edges
A modern way to create arc shapes with rounded edges using minimal code