我有一个 SVG 路径,无论窗口宽度如何变化(就像 #liquids 中的背景 img 一样),我都希望在 SVG 视图中水平居中。我还没有找到解决办法。。
.container {
width: 100%;
}
#liquids{
background: url(http://24.media.tumblr.com/tumblr_lbi4ltLmYL1qb23z5o1_500.jpg) no-repeat scroll center 0 transparent;
width: 100vw;
height: 100vh;
}
#p3 {
fill: #0400ff;
}
<div class=container">
<svg id="liquids">
<g class="p3-g">
<path id="p3" d="M 200 200 C 50 350 100 0 350 50 C 550 100 650 100 650 250 C 650 450 450 300 450 350 C 450 550 250 150 200 200 Z"/>
</g>
</svg>
</div>
我对 SVG 很陌生,如果我在这里遗漏了明显的内容,请原谅我。