This note has an interactive demo. Try it in the original
A gradient border with rounded corners has always needed a trick, and a dashed gradient border has been close to impossible in plain CSS. background-clip: border-area fixes both: it tells the browser to paint a background only where the border is actually drawn. Safari has had it since 18.2, and Chrome 150 shipped it this summer, so it now works in Chromium browsers and Safari.
The problem it solves
There are two classic ways to get a gradient border, and both have a catch.
The first is border-image . It accepts a gradient, but MDN is blunt about it: border-radius "has no effect on the border image". If you want rounded corners, MDN's own advice is to "draw it as the background instead".
That leads to the second trick, which I've copied into more projects than I can count.…