I\'ve embedded an SVG files data directly into my html. It shows in Chrome and Firefox, but in IE11 it doesn\'t show at all. The pastebin link to the SVG is http://pastebin
I was having the same problem with 3 of 4 inline svgs I was using, and they only disappeared (in one case, partially) on IE11.
I had <meta http-equiv="x-ua-compatible" content="ie=edge">
on the page.
In the end, the problem was extra clipping paths on the svg file. I opened the files on Illustrator, removed the clipping path (normally at the bottom of the layers) and now they're all working.
You have duplicate style attributes on each element.
style="opacity:0.8"
This certainly does not display on Firefox for me because of this error. If it displays on Chrome, best raise a Chrome bug.
I figured it out! The page was rendering using IE8 mode... had
<meta http-equiv="X-UA-Compatible" content="IE=8">
in the header... changed it to
<meta http-equiv="X-UA-Compatible" content="IE=9">
9 and it worked!
After trying the other suggestions to no avail I discovered that this issue was related to styling for me. I don't know a lot about the why but I found that my SVGs were not visible because they were not holding their place in the DOM.
In essence, the containers around my SVGs were at width: 0 and overflow: hidden.
I fixed this by setting a width on the containers but it is possible that there is a more direct solution to that particular issue.
I ran into this issue and resolved it by removing the width styling I had used on the SVG:
.svg-div img {
width: 200px; /* removed this */
height: auto;
}
Check if the Browser is IE -
$ua = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8');
if (preg_match('~MSIE|Internet Explorer~i', $ua) || (strpos($ua, 'Trident/7.0') !== false && strpos($ua, 'rv:11.0') !== false)) {
// do stuff for IE Here
}