如何缩放SVG内的链接图像从顶部(当前缩放从中心奇怪) [英] How do I scale a linked image inside an SVG from top (currently scaling from center oddly)

查看:135
本文介绍了如何缩放SVG内的链接图像从顶部(当前缩放从中心奇怪)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个以内联SVG链接的图片,SVG的高度和宽度值已删除。当维度选项设置为百分比时,图像似乎消失了,所以我将它们保持在px值,这是SVG似乎保持为其高度。

I have an image linked in an inline SVG, the SVG has the height and width values removed. The image seems to disappear when dimension options are set to percent so I've kept them at px value, which is what the SVG seems to be keep as its height.

此链接将演示我想要实现的更简单:示例

This link will demonstrate what I'm trying to achieve much easier: example

基本上我想要的SVG的行为像上面的图像,但链接的图像是从它的SVG容器的中心而不是顶部。

Basically I want the SVG to behave as the image above it does, but the linked image is scaling from the center of its SVG container and not the top.

谢谢,

-n

推荐答案

必须做的是添加

svg {
  max-height:100%;
}

到您的CSS。

这篇关于如何缩放SVG内的链接图像从顶部(当前缩放从中心奇怪)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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