Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you style svg tags using css?
    primarykey
    data
    text
    <p>I am trying to use an inline style tag to style my 45 polygons and 5 rectangles. for some reason the first tag that i try to style does not pick up the styling. If I add a third shape at the top then the two underneath it get styled, if I removed the third shape at the top then the second one under it will not be styled. Has this happened to anyone before? </p> <pre><code>&lt;style type="text/css"&gt;&lt;![CDATA[ &lt;!--this rectangle will not be styled --&gt; rect{ fill:none; stroke:black; stroke-width:.5; } polygon{ fill:none; stroke:black; stroke-width:.5; } ]]&gt;&lt;/style&gt; </code></pre> <p>Now using the code below, the rectangle gets styled. (with the second polygon tag at the top)</p> <pre><code>&lt;style type="text/css"&gt;&lt;![CDATA[ polygon{ fill:none; stroke:black; stroke-width:.5; } rect{ fill:none; stroke:black; stroke-width:.5; } polygon{ fill:none; stroke:black; stroke-width:.5; } ]]&gt;&lt;/style&gt; &lt;svg width="400" height="800" viewBox="0 0 400 800" id="svg-doc"&gt; &lt;rect id="central-park" class="shape" x="154" y="370"width="53" height="127" /&gt; &lt;rect id="shape-z10024" class="shape" x="68" y="415" width="85" height="40" /&gt; &lt;rect id="shape-z10023" class="shape" x="68" y="457" width="85" height="40" /&gt; &lt;polygon id="shape-z10034" class="shape" points="189,156 137,122 106,121 101,129 99,155 79,155 78,105 94,79 121,67 128,82 163,61 177,62 191,80" /&gt; &lt;a xlink:href="http://google.com/"&gt; &lt;polygon id="shape-z10040" class="shape" points="188,167 186,155 137,122 108,122 102,126 100,153 77,156 77,166" /&gt; &lt;/a&gt; &lt;polygon id="shape-z10033" class="shape" points="189,166 187,197 187,203 81,203 77,194 78,166" /&gt; &lt;polygon id="shape-z10032" class="shape" points="189,205 160,234 155,248 84,247 80,204" /&gt; &lt;polygon id="shape-z10030" class="shape" points="268,311 196,315 197,299 157,298 157,273 234,273" /&gt; &lt;/svg&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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