Skip to content

Instantly share code, notes, and snippets.

@skozin
Created December 13, 2012 14:44
Show Gist options
  • Save skozin/4276796 to your computer and use it in GitHub Desktop.
Save skozin/4276796 to your computer and use it in GitHub Desktop.
SVG <use> and cascading test
/**
* SVG <use> and cascading test
*/
<!-- content to be placed inside <body>…</body> -->
<svg width="500" height="601">
<defs>
<style type="text/css"><![CDATA[
#defsTmpl, #docTmpl {
fill: red;
stroke: blue;
}
.group {
font-size: 12px;
stroke: black;
stroke-width: 2px;
shape-rendering: crispEdges;
}
.blue {
fill: blue;
}
]]></style>
<rect width="80" height="40" id="defsTmpl" fill="yellow" />
</defs>
<g visibility="hidden">
<rect width="80" height="40" id="docTmpl" fill="yellow" />
</g>
<g class="group" transform="translate(10,10)">
<text stroke="none" fill="black" y="10">Normal</text>
<rect width="80" height="40" y="20" />
<rect width="80" height="40" y="70" fill="orange" />
<rect width="80" height="40" y="120" fill="orange" class="blue" />
</g>
<g class="group" transform="translate(110,10)">
<text stroke="none" fill="black" y="10">Use from defs</text>
<use xlink:href="#defsTmpl" y="20" />
<use xlink:href="#defsTmpl" y="70" fill="orange" />
<use xlink:href="#defsTmpl" y="120" fill="orange" class="blue" />
</g>
<g class="group" transform="translate(210,10)">
<text stroke="none" fill="black" y="10">Use from doc</text>
<use xlink:href="#docTmpl" y="20" />
<use xlink:href="#docTmpl" y="70" fill="orange" />
<use xlink:href="#docTmpl" y="120" fill="orange" class="blue" />
</g>
</svg>
{"view":"split-vertical","fontsize":"70","seethrough":"","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment