corner-shape / border-shape
Corners That Aren’t Round
border-radius has been a one-trick pony for a while. corner-shape keeps the radius you already set and swaps the geometry inside it, so the same corner can be a bevel, a notch, a scoop or a squircle. Underneath they’re all one curve, so you can park anywhere between them and animate along it.
.card {
border-radius: 42px;
corner-shape: squircle;
}All six, same radius
Not an SVG in sight
INTERSTELLAR
Fri 21:00, Screen 4
The CSS
/* border-radius sets the size of the corner.
corner-shape sets what happens inside it. */
.card {
border-radius: 42px;
corner-shape: squircle;
}
/* Four values, same order as border-radius: TL TR BR BL */
.tag {
border-radius: 34px 34px 18px 18px;
corner-shape: scoop scoop round round;
}
/* Every keyword is a point on one curve, so you can sit between them:
notch = superellipse(-infinity) scoop = superellipse(-1)
bevel = superellipse(0) round = superellipse(1)
squircle = superellipse(2) square = superellipse(infinity) */
.dial {
corner-shape: superellipse(1.4);
}
/* border-shape draws the border along any basic shape, including one
with a bite taken out of it. clip-path would shave the border off. */
.ticket {
border: 3px solid;
border-shape: shape(
from 20px 0px,
line to calc(50% - 26px) 0px,
arc to calc(50% + 26px) 0px of 26px ccw,
line to calc(100% - 20px) 0px,
arc to 100% 20px of 20px cw,
/* ...and back around the bottom */
close
);
}How it works
The two properties split the job. border-radius decides how big the corner is, and corner-shape decides what it does with that space.
The six keywords are named stops on a single superellipse curve: notch at negative infinity, scoop at -1, bevel at 0, round at 1, squircle at 2, and square at infinity. superellipse() takes any number in between, and since that’s just a number, the browser can animate between them.
You can shape each corner on its own, either with the four-value shorthand (same TL TR BR BL order as border-radius) or with longhands like corner-top-left-shape. The switch in the demo flips between the two.
corner-shape only touches the corners. border-shape replaces the outline: hand it any basic shape, including a shape() path, and the border, background and shadow all follow. clip-path paints the border and then slices it off.
Limited support
corner-shape landed in Chrome and Edge 139; border-shape is newer still, at Chrome 147. Safari only has corner-shape in Technology Preview and Firefox hasn't shipped it, so treat both as progressive enhancement: without support the corners stay round, which is what they'd have been anyway.
turns, wins and reset, all CSS
trigonometry, in CSS
switch guests on