Inline SVG not working as background-image in IE
Asked Answered
A

1

3

I'm trying to set the background-image css property to encoded data URI content as shown in this fiddle

It works as expected for all browsers I tested. The only browser that doesn't show the contents is IE 9/10.

But I have another example that works in IE 9/10. The difference here is that the data URI contents are initially created in Chrome (by Raphaël) and then used in the example.

If the SVG is created in IE (as in the 1st fiddle by Raphaël) itself it's not being displayed if used as background-image data.

Where is the issue in IE? Is it related to my code or maybe something goes wrong in the Raphaël SVG painting?

Abercromby answered 24/6, 2013 at 6:55 Comment(2)
possible duplicate of SVG background image in IE9Obligor
As my mediatype is already image/svg+xml and no web server is envolved I'm not confident that it might already be answered by the link mentioned aboveAbercromby
N
5

It looks like the most cross-browser compatible way to do this (and the only way to get IE to show the SVG as a CSS background) is to base64 encode (a.k.a dataURI) the SVG as you did in your 1st fiddle.

I found the comments discussion at the bottom of this article helpful

http://css-tricks.com/probably-dont-base64-svg

Nunciature answered 23/1, 2015 at 11:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.