In Chrome (not FF, Safari), I’m unable to style an externally linked (xlink:href) SVG template's sub-elements by class/ID/element reference.
I’d like to know if I’m doing anything incorrectly? Has anyone else encountered this issue?
HTML:
<svg class="my-svg"><use xlink:href="demo.svg#my-icon" /></svg>
demo.svg:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<symbol id="my-icon" viewBox="0 0 21 21">
<title>Mobile Navigation Button</title>
<path class="fml" fill="#BADA55" d="M27.493…"/>
</symbol>
</svg>
CSS:
.my-svg { fill: pink; } /* will work */
#my-icon { fill: brown; } /* won’t work in Chrome */
.fml { fill: green; } /* won’t work in Chrome */
I’ve posted a more detailed demo here: