我正在使用SVG作为背景图像,希望它被拉伸到100% 100%。
然而,Chrome和Firefox似乎都在尽力保留SVG的纵横比,并缩小其宽度。
原始大小
div
{
background: url(image.svg) no-repeat;
background-size: 100% 100%;
width: 14rem;
height: 4rem;
}
双倍宽度
div
{
background: url(image.svg) no-repeat;
background-size: 100% 100%;
width: 28rem;
height: 4rem;
}
双倍高度
div
{
background: url(image.svg) no-repeat;
background-size: 100% 100%;
width: 14rem;
height: 8rem;
}
如何将该 SVG 拉伸?
SVG 内容:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Lager_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 371.7 102.8" enable-background="new 0 0 371.7 102.8" xml:space="preserve">
<polygon fill="#EF9104" points="370.4,100.5 0,100.5 0,0 269.4,0 "/>
</svg>