Inkscape.org
Beyond the Basics style @import of extern css help
  1. #1
    Foobar Foobar @Foobar

    I'm trying to use the <defs><style type="text/css">@import url(components.css)</style></defs> and having difficulty.

    I have an svg i have open called components.svg and the css next to it in the same directory as components.css.

    If i open the svg in a web browser it works fine, but inkscape seems to not be finding it. Is there a directory path somewhere I need to adjust so that it finds it?

    @import url(components.css) is what i have, in the xml editor the import is green, url is purple, components.css is white. I thought at one point this was working ok and to get a refresh I would go in touch the filename in the text element to force a reread. When doing this i thought the filename changed from color to white to color when it foudn it. Now it's always white, but I wasn't paying a lot of attention and this could just be my memory being wrong.

     

    Thanks!

     

     

     

  2. #2
    inklinea inklinea @inklinea⛰️

    I think it just requires a semicolon

    <style type="text/css">@import url(components.css);</style>

    or

    <style type="text/css">@import 'components.css';</style>

    I don't think the <style> element goes inside <defs> - it still works but probably should be after <svg>

    and just have one <style> element per document.

     

  3. #3
    Foobar Foobar @Foobar

    Oh my god, thank you! It was being in <defs> that messed it up, all is good. Way too much time pondering this one...

Inkscape Inkscape.org Inkscape Forum Beyond the Basics style @import of extern css help