Can I use border radius with border images with gradients?
P粉633733146
2023-08-29 12:52:01
<p>I'm designing an input field with a circular border (border radius) and trying to add a gradient to said border. I can successfully make gradients and circular borders, but neither work together. It's either rounded corners without a gradient, or a border with a gradient but no rounded corners. </p>
<pre class="brush:php;toolbar:false;">-webkit-border-radius: 5px;
-webkit-border-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b0bbc4), to(#ced9de)) 1 100%;</pre>
<p>Is there a way to make two CSS properties work together, or is this not possible? </p>
This is possible, and it requires no additional markup , but uses the
::after
pseudo-element .Filters
This is an example (, CSSPie - such as vector spoofing, etc.).
jsfiddle version):
This works on any background-
Works fine whether used with or without - box-shadow
No need for you to add shadows to pseudo elements-
Again, this works in IE, Firefox and Webkit/Blink browsers.,
insetAccording to W3C specification, it may not be possible:
This may be because
border-image
can take on some potentially complex patterns. If you want a circular image border, you'll need to create one yourself.