如何设置上边距(类似于 CSS - margin-top),使图像从顶部移动到中心?
<?xml version="1.0" encoding="windows-1252"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 290 290" xml:space="preserve" style="enable-background:new 0 0 290 290;">
<g xmlns="http://www.w3.org/2000/svg">
<rect y="220" width="70" height="70" fill="#00aeef"/>
<rect y="110" width="70" height="70" fill="#00aeef"/>
<rect width="70" height="70" fill="#00aeef"/>
<rect x="110" y="220" width="70" height="70" fill="#00aeef"/>
<rect x="110" y="110" width="70" height="70" fill="#00aeef"/>
<rect x="110" width="70" height="70" fill="#00aeef"/>
<rect x="220" y="220" width="70" height="70" fill="#00aeef"/>
<rect x="220" y="110" width="70" height="70" fill="#00aeef"/>
<rect x="220" width="70" height="70" fill="#00aeef"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<script xmlns="" type="text/javascript" id="useragent-switcher">navigator.__defineGetter__("userAgent", function() {return "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.9 Safari/537.36"})</script></svg>

中的类比
margin-top是svg改变属性y-minviewBox="x-min y-min 290 290"。通过增加
y-min正值,我们可以提高图像,而减小它可以降低图像。在您的 svg 示例中,图像占据了整个画布,因此您不能立即将图像从顶部移动到底部,因为图像将从底部被切断。下面是您的代码示例,我从中删除了它留下的不必要的行
Adobe Illustrator并将 svg 代码包装在其中div以更改其宽度和高度为百分比以更改整个 svg 图像的大小。这样做是为了使图像响应。添加了红色边框以显示 svg 图像的边框。现在图片占据了整个 svg 画布。viewBox两次,将图像缩小一半svg——viewBox="0 0 290 290"它变成了——viewBox="0 0 580580”y-min=(-145)yviewBox="0 -145 580 580"