HTML5 Inline SVG with external CSS

Andrew

New Member
external CSS and inline SVG in a HTML5-document are really giving me a hard time.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.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:\[code\]body { //blalba}<![CDATA[line { //blabla}circle { //blabla}]]>\[/code\](works fine under chrome)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 I can't get external stylesheets to work within the SVG.Here's the code I'm fiddling with:\[code\]<?xml version="1.0"?><?xml-stylesheet type="text/css" href="http://stackoverflow.com/questions/11311734/styles/style.css" ?><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"> <rect class="background" x="0" y="10" width="825" height="125" /></svg>\[/code\]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:\[code\]<![CDATA[ // <- if tried leaving this out, no changeline { //blabla}circle { //blabla}]]> // <- if tried leaving this out, no change\[/code\]I've also double-checked the path to my stylesheet. What am I doing wrong?Thank you for your help! :)
 
Back
Top