gpt4 book ai didi

css - 在 svg 元素中设置 css

转载 作者:行者123 更新时间:2023-11-28 10:41:52 24 4
gpt4 key购买 nike

我有一个 svg 图像元素。我必须为图像设置边距。

<svg id="chart" preserveAspectRatio="xMidYMid" viewBox="0 0 960 500">

<image class="leaf" x="240.9471668231492" y="362.4164063706163" width="80" height="80" href="http://upload.wikimedia.org/wikipedia/commons/a/ac/ML_maple_leaf.png"></image>
<svg>

我的 CSS 是:-

.leaf
{
margin-top:80px;
}

为什么我的 CSS 不工作。有没有其他方法可以在 svg 中设置 css。

最佳答案

据我所知,SVG 标准没有指定任何像边距这样的东西,这就是它处理不一致的原因。只需设置正确的图像 x 和 y 以及 svg 的正确大小

关于css - 在 svg 元素中设置 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23102229/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com