1
I’m wearing a linear-gradient
as border-imagem
in an element, but thus the edge does not respect the border-radius
that I placed and does not realize the curvature in the vertices.
Here is the code referring to the image above. I left the box-shadow
for you to see that the element .box
is with the border-radius
functioning properly, but the border-imagem
does not respect that border-radius
and continues to perform no curvature at the vertices.
How can I fix this? (other than with SVG)
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
display: flex;
}
.box {
position: relative;
width: 400px;
height: 160px;
margin: auto;
border: 2px solid;
border-image: linear-gradient(red, blue);
border-image-slice: 1;
border-radius: 20px;
box-shadow: 0 0 0 1px green;
}
<div class="box"></div>
Friend would be interesting you put details of what you did, although it seems correct I did not understand what was done and I do not want to give only a crtl+c/v without understanding what was done there. If you copied the code from somewhere it would be interesting to quote the source
– hugocsl
I simplified the editing of the answer, we used the border with double to double the thickness and Transparent to inhibit the default color. In this way we use the new colors via the background-image, and the linear-gradient contemplates the internal filling of the <div> and the radial-gradient is responsible for the color of the border. Background-origin with border-box defines the background positioning area. I hope I helped :)
– Getulio Rafael Ferreira
Sorry friend but I still did not understand... Why radial-gradient and not linear-gradient? And the background-clip is not good for anything? It would be interesting to add an explanation in the field of the answer and not here in the comment, I think it is better for those who have the same doubt to be able to see right without reading the comments here
– hugocsl
Yes friend, I will edit again and try to approach a more coherent explanation, thanks for the feedback, I hope I can help.
– Getulio Rafael Ferreira