The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Chrome not picking up path id's from css or is it me?

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #241268

    This works in Safari and Firefox awesome but to my total shock not woking in chrome.

    Both paths are purple in chrome, even if i remove the fill from .icon-x it shows black never plum and/or skyblue

    — svg —-

    <svg xmlns="" >
            <symbol id="symbol-id"  viewBox="...">
                <path id="path-id-right" d="..."/> **** id and path  only****
                <path id="path-id-left" d="..."/> **** id and path  only****
    ----css -----
    #symbol-id #path-id-left{ fill: plum; }
    #symbol-id #path-id-right{ fill: skyblue; }
    ---html ----
    <svg class="icon-x">
        <use xlink:href="res/img/build/svg-store.svg#symbol-id"></use>

    You’d need to demo it but I’m pretty sure you can’t do it that way….at least not referencing the internals of a <use> by symbol ID.


    The goal is to have multicolor svgs, I’m the designer and the html/css guy at work so I’m naming the layers in my illustrator file so the paths in my svg’s can be changed by my css on the fly by referencing the ID’s but chrome doesn’t seem to care.

    In the link the X icon should be blue and pink. Chrome not working

    View in Safari, Firefox, Chrome:


    –svg— (inspect to see svg defs chunk)


    Works for me in Chrome 51

    But this won’t work if the SVG isn’t inline in the document somewhere.

    Otherwise I think you need a JS helper script. “SVG4Everyone” I think it’s called.


    Ha you must know a guy

    Version 50.0.2661.94 (64-bit)

    Google Chrome is up to date.

    Actually your pen works in 50 with the def in the html . But my example has an external reference (<use xlink:href=”svg-store.svg#x”></use>). Guess i’ll have to wait for Chrome 51 way back here hahaha


    Paulie_D’s pen works for me in chrome version 50.0.2661.94 m.

    Like Paulie_D wrote, chrome won’t let you apply css to an external svg. As far as I know this is the expected behavior.

    See this thread for a more detailed discussion:


    great, you have 50 so look at my link and inspect it . I’ve included the svg4everbody.js and still no dice .

    So if the answer is NO externals in chrome cool , then I can work on a plan B . I’m making sure I’m not missing something because it seems like a no brainer for google

    thanks guys for awesome input


    Yeah, I’m not totally sure about what that plugin is supposed to do… as you wrote, the fill colors are still not being applied in chrome. I’m pretty sure it is just not possible for chrome to apply css directly to elements in an external svg file.

    I do think you could add a fill to the <use> element’s style, and that would cascade down to the svg.

    I believe the issue is due to the fact that when an external svg is added via a <use> element, it is not actually added to the DOM.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘CSS’ is closed to new topics and replies.