I am not sure if the questions has been yet properly asked, but I am looking for a legit answer to this problem.
I am trying to achieve the following.
- Create div with a border
- Give div a radius (make circle)
- Give border a gradient
- Keep background of div transparent
I have found examples that would allow me to create a gradient border, but in most cases the background of the div was not transparent but had a color matching the body background. example
One way that I found to add a border to your div is shown below, though this does not allow you to use border-radius and therefor keeps your div as a square, although allowing your background to be transparent, it does not allow your shape to be a circle.
border-image:linear-gradient(to right,#23966c, #faaa54, #e23b4a, #db0768, #360670);
border-image-slice:1;
I have also tried to use clip-path circle, but have not found anything that works.
One last solution that struck me was to use font, I have looked for the roundest "o" in google fonts and found the font family "Josefin Sans". Used the "o" as my circle, but doing such leaves me in a bind with the width of the border. the following code below was used to achieve a gradient clip on my text.
background: linear-gradient(to right,#23966c, #faaa54, #e23b4a, #db0768, #360670);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
see codepen example.
I am considering to create svg.. but if anyone has came across a solution for this please let me know.
Thank you.