Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have several options here. Since you are already uniquely identifying each SVG element, you can make your embedded rules more specific, so that in the whole-page context, they only apply to the SVG they were packaged with, i.e.</p> <pre><code>svg#svg-one #ultimate-green-ness { properties here} </code></pre> <p>you can also just set the fill (or just about anything else) via normal svg attributes, which would take your styling out of the CSS namespace and prevent conflicts, the styling would obviously then be on a per-element level</p> <pre><code>&lt;svg&gt;&lt;rect fill="#ffffff" etc... /&gt; </code></pre> <p>note that you can still override these styles with external style sheets or JS code. lastly, to continue the thought you were suggesting above, you can just give ID's to your rects, no need for a group there...</p> <p>hope that helps.</p> <p>EDIT: couple more options... use a <code>&lt;def&gt;</code> to contain the styles, then apply that Def to the element, or simply put a "style" attribute in the svg element, although this doesn't scale well in your case.</p> <p>Lastly, to explain your situation, the stacking of the style tags works the same way it would in HTML, that is , if you had several different blocks in your HTML (or SVG) the browser simply concats them all into one effective stylesheet and cascades according to the CSS spec. No getting around that.</p> <p>the spec is helpful here... <a href="http://www.w3.org/TR/SVG/styling.html#StylingWithCSS" rel="nofollow">http://www.w3.org/TR/SVG/styling.html#StylingWithCSS</a></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