使用SVG对图像进行居中 [英] Centering image with SVG

查看:3076
本文介绍了使用SVG对图像进行居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 .svg 文件中有以下图片:

I have the following image in my .svg file:

<image xlink:href="developer.mozilla.png" x="50%" y="50%" height="62" width="71"/>

我希望它显示在页面中间,但似乎左上角是中间。如何让图像的中心显示在页面中央?

I want it display in the middle of the page, but it seems that the upper left corner is in the middle. How can I get the center of the image to display in the center of the page?

推荐答案

这样的事情应该有效:

<image xlink:href="developer.mozilla.png" x="50%" y="50%" height="62" width="71" transform="translate(-35.5,-31)"/>

这篇关于使用SVG对图像进行居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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