【发布时间】:2013-03-20 03:44:24
【问题描述】:
我从各种来源收集到 svg 中的 vector-effect="non-scaling-stroke" 应该在当前版本的 Opera、Firefox 和 Chrome 中工作。 (不确定 IE10)。
但是我只能让它在 Opera 和 Firefox 中工作,然后只有当它直接嵌入为图像时,如果它在 CSS 中缩放为背景图像,则它不起作用。
我的问题:
为什么不镀铬?
为什么不在背景图片中?
我可以在所有最新的浏览器中使用它吗?
HTML:
<div><img src="http://dl.dropbox.com/u/60476509/close.svg" /></div>
<div><img id="one" src="http://dl.dropbox.com/u/60476509/close.svg" /></div>
<div id="two"></div>
<div id="three"></div>
CSS:
#one {
width: 200px;
height: 200px;
}
#two {
background-image: url("http://dl.dropbox.com/u/60476509/close.svg");
height: 100px; /* native size */
width: 100px;
background-size: contain;
}
#three {
background-image: url("http://dl.dropbox.com/u/60476509/close.svg");
height: 200px;
width: 200px;
background-size: cover;
}
【问题讨论】:
-
如果您将 SVG 内联放置在 Chrome 中:jsfiddle.net/42mq6,但不确定如何解决您的问题。
-
@Duopixel 谢谢,这是一个改进,即使很麻烦。