1

I try to integrate a SVG from a CSS file with the following code:

.circle:before {
    content: url('data:image/svg+xml;charset=UTF-8, <svg width="100" height="100" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"/></svg>');
}
<div style="color:red; fill:blue;">
    <div class="circle"></div>
    <svg width="100" height="100" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"/></svg>
</div>

I can't figure out why the color is applied when the SVG is inserted in the HTML and is not applied when the SVG is created from the CSS?

Fifi
  • 3,360
  • 2
  • 27
  • 53

0 Answers0