Closed jackfearing closed 8 years ago
Hi @jackfearing, if I understand your issue correctly this is not a problem that's related to svg-sprite / gulp-svg-sprite or the construction of the sprite. It's rather a limitation of current SVG support in browsers that you cannot apply arbitrary CSS on SVG elements that are <use>
d. I'm pretty sure your hover code would work if your SVG was truly inlined (without the use of <use>
).
Under certain circumstances there might be a solution for your special problem though, using currentColor
in your CSS. Please see here for a description of the technique. Good luck!
Thanks for the quick response. Just a follow-up question. If I wanted to use an inline svg icon based the export gulp code. What would be the markup if I don't use the <use>
tags?
Example:
How would I get this to display?
<svg class="notification"><use xlink:href="#notification"/></svg>
Hello, I'm currently the gulp structure below (also attached) for my SVG icon system and have it exporting out to a php file to include in the head of Wordpress so I can use SVG's on the page.
For the most part everything works great however when I try to apply a hover: class to change the SVG fill, I'm not able to change the fill. I can change the fill if I use but not on hover. I assuming it's because of the path after the #ID.
Is there a better way I should be exporting my SVG or have my GULP file setup? The goal is to use symbol for my SVG's.
CSS
PHP
<div><svg><use xlink:href="#pin"/></use></svg></div>
Gulp
Gulp-SVG.txt