Create a gradient border with a border radius
P粉930448030
2023-08-13 16:23:14
<p>I have the following CSS: </p>
<pre class="brush:php;toolbar:false;">a.btn.white-grad {
background: $lgrey;
color: #313149 !important;
border: 1px solid #000;
border-image-source: linear-gradient(to right, #9c20aa, #fb3570);
border-image-slice: 20;
float: left;
@include font-size(26);
margin: 75px 0;
}</pre>
<p>Adding <code>border-radius: 5px</code> doesn't seem to have any effect. I think this is because I'm using a border gradient... Is there a way to achieve the desired 5px border radius? </p>
2023 - Single element, no pseudo-elements, no SVG, no masks.
I can't be responsible for this, I saw it on a website (I forgot the name of the website and can't find it).
inset
box-shadow
to fill the inner white2021: If you want transparency, I recommend using the CSS mask method as the support is pretty good now
You cannot use
border-radius
in gradients. Here's another idea, you can rely on multiple backgrounds and adjustbackground-clip
: