删除“填充"来自SVG? [英] Removing "padding" from SVG?

查看:28
本文介绍了删除“填充"来自SVG?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绘制圆的 SVG 图形.当我给它一个带有 CSS 的 background-color 时,我希望它只出现在角落里,因为 CSS 元素从不圆(是的,是的,border-radius...) - 所以我将一个带有透明背景的圆形图形放在一个带有背景颜色的矩形框中.
但相反,它看起来像这样:

I have a SVG graphic that draws a circle. When I give it a background-color with CSS, I expected it to show up only in the corners because CSS elements are never round (yes yes, border-radius...) - so I put a round graphic with a transparent background in a rectangular box with background color.
But instead, it looks like this:

有什么办法可以去掉左边的填充"&右边?和ViewBox有关系吗?

Is there any way I can remove the "padding" on the left & right side? Has it something to do with ViewBox?

推荐答案

如果您希望 SVG 拉伸到整个框,请将 preserveAspectRatio="none" 放在根 上.svg> 元素.

If you want the SVG to stretch to the entire box, put preserveAspectRatio="none" on the root <svg> element.

这篇关于删除“填充"来自SVG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆