拉伸png背景图像很容易:
.stretched-logo-bg {
background: url("../img/curve.png") center center no-repeat;
background-size: 100% 100%;
}不过,这不适用于SVG背景
.stretched-logo-bg {
background: url("../img/curve.svg") center center no-repeat;
background-size: 100% 100%;
}它不会被拉伸,它会保持它的纵横比,只是居中。
至少在Chrome 52中
发布于 2016-09-10 15:03:59
如果需要覆盖正在显示的SVG的preserveAspectRatio,可以使用SVG fragment identifier来执行此操作,例如
.stretched-logo-bg {
background: url("../img/curve.svg#svgView(preserveAspectRatio(none))") center center no-repeat;
background-size: 100% 100%;
}发布于 2016-09-10 05:27:49
我不相信你可以让SVG像PNG那样扭曲。
但是,如果您主要支持现代浏览器,则可以向SVG标记添加preserveAspectRatio="none"属性。
例如:
<svg version="1.1" preserveAspectRatio="none" .. etc`https://stackoverflow.com/questions/39418463
复制相似问题