Any ideas why patterned SVG file is showing up blank in the browser?

后端 未结 3 1788
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 08:07

I have an svg file that I created in Illustrator that consists of a pattern - it was made using the swatch tool. When I try and load it locally it shows up blank in the browser

相关标签:
3条回答
  • 2021-01-25 08:26

    If you find that it works in Firefox, IE or Edge but not Chrome, this was my issue too.

    I fixed it by opening the .SVG file in a text editor, and everywhere I saw this tag:

    xlink:href="data:img/png;base64

    I replaced it with

    xlink:href="data:image/png;base64

    This fixed it, and it displayed immediately. Hopefully this helps someone!!

    0 讨论(0)
  • 2021-01-25 08:46

    Hope you got this sorted, but for anyone else having this issue: Check the saving as .svg settings within Illustrator.

    The standard settings gave me a blank .svg, but when I messed with the settings (Font type: SVG, CSS Properties: Style Attribute, Output fewer elements unchecked, Include XMP checked) it worked fine.

    On a side note, using .svg is fine on a website, as long as you have a fallback for browsers that don't support them. I believe modernizr (http://modernizr.com/) covers setting that up.

    0 讨论(0)
  • 2021-01-25 08:48

    Browsers have varying levels of SVG support, so your browser may just not support patterns.

    If it's part of a website, I'd just export it as a PNG, as a vector image as big as this would bog down visitors' computers anyway.

    0 讨论(0)
提交回复
热议问题