Styles inside svg are being skipped
See original GitHub issueHi, I’m facing the following issue, on the https://codepen.io/jhildenbiddle/pen/ZxYJrR/ if i change the html main with:
<main>
<strong>Transformed CSS</strong>
<a href="https://jhildenbiddle.github.io/css-vars-ponyfill" target="_blank">What is this?</a>
<pre><code></code></pre>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="user-icon" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve" style="overflow: visible;"><style type="text/css">.st0 {
fill: var(--icon-bg, #e1e1e1);
}
.st1 {
fill: #ffffff;
}
</style><g><circle class="st0" cx="256" cy="256" r="256"></circle><g class="st1"><path d="M244.9,286.8l-5-124h34.2l-5,124H244.9z"></path><path d="M235.3,328.3c0-6.9,1.8-12.1,5.5-15.6c3.7-3.5,9.1-5.3,16.1-5.3c6.8,0,12.1,1.8,15.8,5.4
c3.7,3.6,5.6,8.8,5.6,15.5c0,6.5-1.9,11.6-5.7,15.3c-3.8,3.7-9,5.6-15.8,5.6c-6.9,0-12.2-1.8-16-5.5
C237.2,340.1,235.3,334.9,235.3,328.3z"></path></g></g></svg>
</main>
The output shows us:
<style type="text/css" data-cssvars="skip" data-cssvars-job="1">.st0 {
fill: var(--icon-bg, #e1e1e1);
}
.st1 {
fill: #ffffff;
}
</style>
Why is being skipped? I’m trying to use this svg on IE11 but the value fill: var(--icon-bg, #e1e1e1);
is not being picked up.
Thank you for your great tool!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
"Background" style property ignored for <svg> elements inside ...
The issue is that, when an <svg> is embedded in HTML, it kind of does double-duty as both an SVG element and an...
Read more ><style> - SVG: Scalable Vector Graphics - MDN Web Docs
The SVG <style> element allows style sheets to be embedded directly within SVG content. Note: SVG's style element has the same attributes as...
Read more >SVG Style Inheritance and the 'Flash Of Unstyled SVG'
This—allow me to call it—Flash of Unstyled SVGs (FOUSVG) is caused by the lack of width and height attributes on the <svg> element....
Read more >5 Gotchas You're Gonna Face Getting Inline SVG ... - CSS-Tricks
My recommendation is to just hide/show via CSS classes (Technique #1 described in Swapping Out SVG Icons article), and be sure to target...
Read more >T68672 SVG style element ignored if no type attribute is ...
That was probably an OK thing when librsvg was also requiring the type attribute. In other words, it had been a useful bug....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in 2.4.2. 🎉
Yes without #144 i’m getting
undefined
on:node.sheet.disabled = true;
I merged both branches into one and now works fine for me. Tested on Chrome, ie11 and edge42 (legacy one) So thumbs up! 👍