1

My goal is to have a background image that would stretch to fill the entirety of the container and stretch without keeping the ratio. I find that the following code would work with png files but not svg.

div
{
    background:url("/img/png/angle.png");
    background-size:100% 100%;
    background-repeat:no-repeat;
}

So, that would work, but if I replace png with svg, it would keep its proportion, which is what you want most of the time, but not this particular time.

So, I don't absolutely have to use background-image. If using a img tag makes it work, I'll use that. All I want is for the image to stretch to fill and do NOT keep its proportion.

4

1 回答 1

4

添加preserveAspectRatio="none"<svg>元素,这应该使它工作。

于 2013-09-18T13:17:34.543 回答