6
好的,我得到了以下内容:通过css插入到html中的具有不同宽度/高度的多个svg图像。我想将它们全部缩放到相同的宽度,但不起作用(至少在Safari,Chrome和Firefox中不适用)。resize插入内容的svg图像:url()
HTML:
<h4 class="before" id="foo">Foo</h4>
<h4 class="before" id="bar">Bar</h4>
<h4 class="before" id="foobar">Foobar</h4>
CSS:
.before:before { width: 20px; }
#foo:before { content:url('foo.svg'); }
#bar:before { content:url('bar.svg'); }
#foobar: before { content:url('foobar.svg'); }
我怎么能调整的SVG图像,使它们显示与每个20像素宽度(但不改变SVG本身)?
1年半后,''background-size:cover'解决了这个问题(jsfiddle:http://jsfiddle.net/8t2C9/),你的方法正是朝着这个方向发展的。谢谢。 –