按钮在FF,Chrome,Safari中显示正常。将无法在IE 7/8中呈现。
这是我给出的代码:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="RadMenu.css">
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<g id="g" shape-rendering="inherit" pointer-events="all">
<circle cx="400" cy="210" r="25.6" fill="white" stroke="#505055" strokewidth="2">
</circle>
<foreignObject x="383" y="192" width="32" height="32" id="PBtn16400210">
<html>
<body>
<div class="Btn3D" title="" style="width: 101%; height: 100%; background-color: rgb(218, 184, 82); text-align: center; vertical-align: middle; background-position: initial initial; background-repeat: initial initial;"></div>
</body>
</html>
</foreignObject></g>
</svg>
</body>
</html>
答案 0 :(得分:4)
Internet Explorer在v9之前不支持SVG(即使那时它只是基本支持)。
答案 1 :(得分:2)
Raphaël为您进行SVG到VML转换,它了解原生SVG。听起来好像学习VML在你的情况下是值得的。
需要注意的一件重要事情是IE 9,也不支持10支持SVG中的异物。虽然SVG规范中是可选的,但在支持某些功能时它可能是一个严重的问题。所有其他主流浏览器都支持它。事实上,您的代码在任何IE版本中都无法正确呈现。
答案 2 :(得分:0)
IE在IE9中添加了对SVG的支持。以前的版本不支持它,也不会工作。 IE确实支持自己的称为VML的矢量格式,因此可以编写polyfill。一个这样的项目是SVGWeb,它使用Flash来实现支持。根据您的需要,它应该运作良好。
有关详细信息,请参阅http://code.google.com/p/svgweb/。
答案 3 :(得分:0)
答案 4 :(得分:0)
以下是解决方案:在SVG之后添加此代码。
<!--[if lte IE 8]><img src="image.png"><![endif]-->
(资料来源:https://j.eremy.net/inline-svg-with-ie8-fallback-support/)
在测试html上,顶部和底部按钮之间的图像是SVG,蓝色。对于资源管理器8是PNG,红色。
a {text-decoration:none}
button {
padding-bottom:2px;
width: 159px;
height: 29px;
border: 3px solid transparent;
border-radius: 75px;
color: #fff;
display: block;
font-weight: bold;
font-size: 1.25em;
margin: 0.75em auto;
position: relative;
cursor: pointer;
}
.btn-TOP {border: #7766A6;
background-color: #7766A6;
}
.btn-BOT {border:#F47320;
background-color: #F47320;
}
.CENTER {margin: 0 auto;
position:relative;
display: block;
}
&#13;
<a href=""><button class="btn-TOP" id="CT">TOP</button></a>
<p><?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg class="CENTER" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="160px" height="30px"
viewBox="0 0 159 29" enable-background="new 0 0 159 29" xml:space="preserve">
<g>
<path fill="#0072BB" d="M17.7,0.6l11.5,14L17.8,28.4h123.4l-11.4-13.9l11.5-14H17.7z"/>
<g>
<path fill="#FFFFFF" d="M51.3,15.8c0,1.9,0,3.2-0.1,4c-0.1,0.8-0.3,1.5-0.7,2.1c-0.4,0.6-1,1.1-1.7,1.5c-0.7,0.3-1.5,0.5-2.5,0.5
c-0.9,0-1.7-0.2-2.4-0.5c-0.7-0.3-1.3-0.8-1.7-1.5s-0.7-1.4-0.8-2.1c-0.1-0.8-0.1-2.1-0.1-4v-3.2c0-1.9,0-3.2,0.1-4
c0.1-0.8,0.3-1.5,0.7-2.1c0.4-0.6,1-1.1,1.7-1.5c0.7-0.3,1.5-0.5,2.5-0.5c0.9,0,1.7,0.2,2.4,0.5c0.7,0.3,1.3,0.8,1.7,1.5
c0.4,0.7,0.7,1.4,0.8,2.1c0.1,0.8,0.1,2.1,0.1,4V15.8z M46.9,9.7c0-0.9,0-1.4-0.1-1.7c-0.1-0.2-0.3-0.4-0.5-0.4
c-0.2,0-0.4,0.1-0.5,0.3c-0.1,0.2-0.2,0.8-0.2,1.7v8.7c0,1.1,0,1.7,0.1,2c0.1,0.3,0.3,0.4,0.6,0.4c0.3,0,0.5-0.1,0.6-0.4
c0.1-0.3,0.1-1,0.1-2.1V9.7z"/>
<path fill="#FFFFFF" d="M52.9,4.9H56c2.1,0,3.5,0.1,4.2,0.3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8.5h-3.7V4.9h3.7l2.5,8.4V4.9H98.2z"/>
<path fill="#FFFFFF" d="M107.6,4.9l2.5,18.6h-4.5l-0.2-3.3h-1.6l-0.3,3.3H99l2.2-18.6H107.6z M105.2,16.9
c-0.2-2.1-0.4-4.7-0.7-7.8c-0.4,3.6-0.7,6.2-0.8,7.8H105.2z"/>
<path fill="#FFFFFF" d="M115.2,4.9v14.9h2.7v3.7h-7.1V4.9H115.2z"/>
</g>
<g>
<polygon fill="#FFFF00" points="146.9,5.1 149.4,10.1 154.9,11 150.9,14.9 151.9,20.4 146.9,17.8 141.9,20.4 142.9,14.9 138.9,11
144.4,10.1 "/>
<polygon fill="#FFFF00" points="12.1,5.1 14.6,10.1 20.1,11 16.1,14.9 17.1,20.4 12.1,17.8 7.1,20.4 8.1,14.9 4.1,11 9.6,10.1
"/>
</g>
</g>
</svg>
<!--[if lte IE 8]>
<img src="https://image.ibb.co/juwfov/FLAG.png" class="CENTER">
<![endif]-->
</p>
<a href=""><button class="btn-BOT" id="CT">BOTTOM</button></a>
&#13;