gpt4 book ai didi

html - 如何在 css 中增加 svg 图像的高度?

转载 作者:太空宇宙 更新时间:2023-11-03 21:04:00 25 4
gpt4 key购买 nike

我正在处理 svg 图像(如带有四个三 Angular 形的箭头标记的屏幕截图所示)html 代码 如下所示属于我想要的网页增加它的高度

enter image description here

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">
<style>.path-one,.path-two{fill-rule:evenodd;clip-rule:evenodd;fill:#00afc9}.path-two{opacity:.4;fill:#93c83d}</style>
<path class="path-one" d="M30 30H0V0"></path>
<path class="path-two" d="M0 30V0h30"></path>
</svg>

我尝试在 svg 标签中添加内联 width="150px"height="150px" 但它似乎不起作用。

问题陈述:

我想知道我应该在上面的代码中进行哪些更改,以便更改 svg 图像的高度

最佳答案

您可以使用 CSS 实现相同的结果,并且它会更容易处理:

.box {
display:inline-block;
width:150px;
height:150px;
background:
linear-gradient(to top left ,transparent 49.3%,rgb(147, 200, 61,0.4) 50%),
linear-gradient(to bottom left,transparent 49.3%,#00afc9 50%);
}
<div class="box">

</div>

您还可以将其集成为黑色条的背景:

.box {
height:60px;
background:
linear-gradient(to top left ,transparent 49.3%,rgb(147, 200, 61,0.4) 50%),
linear-gradient(to bottom left,transparent 49.3%,#00afc9 50%),
#000;
background-size:60px 100%;
background-repeat:no-repeat;
}
<div class="box">

</div>

关于html - 如何在 css 中增加 svg 图像的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55835827/

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