Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML5 Inline SVG with external CSS
    text
    copied!<p>external CSS and inline SVG in a HTML5-document are really giving me a hard time.</p> <p>I'm currently developing under the latest version of Chrome for Mac and wanted to get my SVG, which is styled with an external stylesheet, working for Firefox.</p> <p>For Chrome, having my SVG-CSS inside the stylesheet for my webpage works fine. I just style all the html-elements and then the SVG-stuff. My stylesheet then looks something like this:</p> <pre><code>body { //blalba } &lt;![CDATA[ line { //blabla } circle { //blabla } ]]&gt; </code></pre> <p>(works fine under chrome)</p> <p>Now, if I go that route, all my SVG-elements in Firefox have a black fill, so this doesn't seem to work. Inline-CSS works fine inside the SVG, but <strong>I can't get external stylesheets to work within the SVG</strong>.</p> <p>Here's the code I'm fiddling with:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;?xml-stylesheet type="text/css" href="styles/style.css" ?&gt; &lt;svg width="827" height="185" viewBox="0 0 827 185" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"&gt; &lt;rect class="background" x="0" y="10" width="825" height="125" /&gt; &lt;/svg&gt; </code></pre> <p>I thought this was the correct way to do it, but it works neither in Chrome nor in Firefox. My stylesheet looks something like this:</p> <pre><code>&lt;![CDATA[ // &lt;- if tried leaving this out, no change line { //blabla } circle { //blabla } ]]&gt; // &lt;- if tried leaving this out, no change </code></pre> <p>I've also double-checked the path to my stylesheet. What am I doing wrong?</p> <p>Thank you for your help! :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload