I have this project where I need to draw a circle. I try to do this with a div which I give a border that draws a linear-gradiant. But this border also needs to be transparent. But I can't seem to get it to work. I get the gradient to work. But I have no idea how to add the transparency to this border.
This is the code I am using at this point:
.gradient-circle {
--b: 5px; /* border width*/
display: inline-block;
margin: 10px;
z-index: 0;
width: 26rem;
height: 26rem;
}
.gradient-circle:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: var(--c, linear-gradient(to top, #5454d4, rgba(249, 116, 104)));
-webkit-mask: radial-gradient(
farthest-side,
transparent calc(100% - var(--b) - 1px),
#fff calc(100% - var(--b))
);
mask: radial-gradient(
farthest-side,
transparent calc(100% - var(--b) - 1px),
#fff calc(100% - var(--b))
);
border-radius: 50%;
}
This is the border I am getting using the above CSS:
This is how the circle should look like:
Use 2 mask layer combined with
mask-composite