Jit*_*yas 8 html5 internet-explorer svg cross-browser
根据IE网站 SVG支持.根据这个答案,什么是SVG(可缩放矢量图形)支持的浏览器?
http://jsfiddle.net/jitendravyas/2UWNe/show/
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="100%" height="100%" viewBox="0 0 480 360"
xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="button_surface" gradientUnits="objectBoundingBox"
x1="1" x2="1" y1="0" y2="1">
<stop stop-color="#434343" offset="0"/>
<stop stop-color="#000000" offset="0.67"/>
</linearGradient>
<linearGradient id="virtual_light" gradientUnits="objectBoundingBox"
x1="0" x2="0" y1="0" y2="1">
<stop stop-color="#EEEEEE" offset="0" stop-opacity="1"/>
<stop stop-color="#EEEEEE" offset="0.4" stop-opacity="0"/>
</linearGradient>
</defs>
<!-- button content -->
<rect x="10" y="10" rx="15" ry="15" width="150" height="80"
fill="url(#button_surface)" stroke="#363636"/>
<text x="30" y="55" fill="white"
font-family="Tahoma" font-size="20" font-weight="500">
SVG Button
</text>
<!-- vitual lighting effect -->
<rect x="12" y="12" rx="15" ry="15" width="146" height="76"
fill="url(#virtual_light)" stroke="#FFFFFF" stroke-opacity="0.4"/>
</svg>
Run Code Online (Sandbox Code Playgroud)
Phr*_*ogz 19
IE似乎错误处理了缺失的preserveAspectRatio属性.您可以通过添加在IE中进行扩展,preserveAspectRatio="xMinYMin slice"如下所示:http:
//jsfiddle.net/2UWNe/4/show
但是,IE显示的不是正确的行为,因此这种更改会导致其他浏览器的行为与IE不同.(但是,Microsoft 认为他们支持preserveAspectRatio.)
我没有深入研究你的单位或内容边界框.你真正想要达到什么效果?
SVG的缩放方式与JPG,PNG和GIF等具有明确定义尺寸的光栅图像的缩放方式不同.
您将需要诉诸黑客以保证跨浏览器的相同显示.
试试这个:
<svg width="100%" height="100%" viewBox="0 0 480 360" preserveAspectRatio="xMidYMin slice" style="width: 100%; padding-bottom: 99.99%; height: 1px; overflow: visible; box-sizing: content-box; enable-background:new 0 0 381.1 381.1;" ... >
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25225 次 |
| 最近记录: |