I've got a linearGradient in the defs section of my SVG file, and reference it with fill="url(#myGradientName)". That works great so far.
I think I should be able to put my whole defs section in its own SVG file, and then just reference that from all my SVG images. That is, something like:
styles.svg:
<svg xmlns=...>
<defs>
<linearGradient id="myGradient" ...>
</linearGradient>
</defs>
</svg>
image.svg:
<svg xmlns=...>
<rect width="100" height="100" fill="styles.svg#myGradient"/>
</svg>
But I can't seem to get the style to apply. Do I have the wrong syntax for IDs external to this file (styles.svg#myGradient)? Do I need to explicitly include the file first somehow?
I've been pouring over the SVG spec and it looks like this should be possible, but none of the examples actually show it being done.
Edit: The FOP FAQ suggests that the correct syntax is fill="url(grad.svg#PurpleToWhite)", but that doesn't work in Gecko or Webkit. Is that correct and nobody supports it, or am I doing something else wrong?
The SVG format allows for the nesting of SVG graphics. It is possible for an “<svg>” elements, to be placed within another “<svg>” element.
First, upload the SVGs using the above button or drag and drop them directly to the editor to combine multiple SVG images. Once uploaded, place the SVG images together either vertically, horizontally, or at any position. Lastly, download the merged SVG image in multiple file formats.
3. How to use inline SVG images. SVG images can be written directly into the HTML document using the <svg> </svg> tag. To do this, open the SVG image in VS code or your preferred IDE, copy the code, and paste it inside the <body> element in your HTML document.
It looks like this is only supported under Firefox 3.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With