SVG和Internet Explorer?
答
即低于版本9不支持SVG组件,但IE 8和下方支撑VML而是使SVG在最近版本的IE浏览器的工作,你可以在你的HTML文件的头部输入以下代码
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<!--[if IE]>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<style>
.chromeFrameInstallDefaultStyle {
position:fixed;
overflow:auto;
width: 800px; /* default is 800px */
height: 80%; /* default is 800px */
border: 5px solid blue;
right:100px;
bottom:100px;
z-index: 99999 !important;
}
</style>
<div id="prompt">
<!-- if IE without GCF, prompt goes here -->
</div>
<script>
// The conditional ensures that this code will only execute in IE,
// Therefore we can use the IE-specific attachEvent without worry
window.attachEvent("onload", function() {
CFInstall.check({
mode: "inline", // the default
node: "prompt"
});
});
</script>
<![endif]-->
这将要求用户在IE上安装谷歌框架。只需要几分钟。之后,所有html5组件以及SVG组件都可以使用。
答
http://caniuse.com/#search=svg
为IE
<img src="image.svg" onerror="this.onerror=null; this.src='image.png'">
的Modernizr:
.main-header {
background: url(logo.svg) no-repeat top left;
background-size: contain;
}
.no-svg .main-header {
background-image: url(logo.png);
}
和其他解决方案:
<svg> ... </svg>
<div class="fallback"></div>
.logo-fallback {
display: none;
}
.no-svg .logo-fallback {
background-image: url(logo.png);
}
有点像IE6如何支持CSS? :-) – Ken 2010-08-20 17:06:45
你知道这样的插件可以在IE6,7,8的32位和64位版本中使用吗? – 2011-03-09 08:00:50