SVG and external style sheets

I use some interactive / dynamic SVGs on my site, and as a function we have the ability to upload the .svg file as is.

One of the problems that we discovered is that when external stylesheets are used, styles are lost if the user, say, tries to open the file in Inkscape. Thus, I used the fill style and color of strokes, etc. Built into the elements.

I'm curious about the SVG standard and how styles fit into it. .Css files intended for transportation using a .svg file? I understand that you can declare external stylesheets like this:

<?xml-stylesheet type="text/css" href="mystylesheet.css" ?>

Will most vector graphics programs recognize and load this if they are in the same folder? Illustrator does not seem to have initial support for SVG, but it has add-ons that include JavaScript and CSS3.

I can't help but feel that everyone missed the SVG boat. Has anyone been successful doing something like, packing .svg with .css for download and trying this in various vector graphics programs? What do programs like Inkscape usually do when they save SVG, since there are several ways to style styles?

+4
source share
1 answer

I found several documents from the W3C on SVG view matching that clear some of them:

Compliance SVG Viewer

CSS styling

Styling Alternatives

Common objects used by SVG and CSS

I saw this line,

Matching SVG interpreters and matching SVG viewers that support the CSS style of common (e.g. textual) XML content is also required to support the CSS style of SVG content.

which is why I believe that only SVG users who support CSS (as opposed to presentation attributes) are required to support external style sheets, so basically just browsers.

I would still like to have a list of SVG software packages and each of them supports external style sheets, as well as how they assign styles, but I may have to do this research for myself.

+3
source

All Articles