Skip to main content
CSS Tip

Triangle shape with rounded corners

A modern way to create a triangle with rounded corners

triangles with rounded corners

.tri {
--r: 40px; /* the radius */

width: 300px;
aspect-ratio: 1/cos(30deg);
mask:
conic-gradient(from -30deg at 50% calc(200% - 3*var(--r)/2),#000 60deg,#0000 0)
0 100%/100% calc(100% - 3*var(--r)/2) no-repeat,
radial-gradient(var(--r) at 50% calc(2*var(--r)),#000 98%,#0000 101%),
radial-gradient(var(--r),#000 98%,#0000 101%) space no-repeat
0 100%/calc(2*tan(60deg)*var(--r)) calc(2*var(--r));
clip-path: polygon(50% 0,100% 100%,0 100%);
}

See the Pen Rounded triangles (the modern way) by Temani Afif (@t_afif) on CodePen.

We can also have a cool hover effect

See the Pen Rounded triangles with hover effect by Temani Afif (@t_afif) on CodePen.

More CSS-only triangle shapes: css-generators.com/triangle-shapes