I've been tinkering with a project that incorporates SVG icons, hoping to style them using CSS for various scenarios and hover effects. However, my attempts are falling short in Webkit, while Firefox is displaying the icons as intended:
http://codepen.io/poopsplat/pen/ycaod
My approach involves following Chris Choyier's technique outlined in his Icon System with SVG Sprites article, which entails including a defs file on the page and inserting <svg>
elements that reference specific <symbol>
elements via their id
attribute using the <use>
tag. Additionally, I'm using Grunt-svgstore to streamline the creation of the SVG defs file.
Chris's demo (http://codepen.io/chriscoyier/pen/EBHlD) functions smoothly in Webkit, even when nesting the icons into containers for targeted styling. He utilizes <g>
elements and styles those, whereas the output from Grunt-svgstore wraps individual icons in <symbol>
elements with corresponding id
s referenced in the HTML. I adjusted my SVG defs file format to align with Chris's setup, but it didn't resolve the issue.
I'm puzzled by the discrepancy between my implementation and Chris's example - any insights on why targeting these SVG icons is problematic in Webkit?