简体   繁体   English

我如何用颜色填充SVG

[英]How do i fill SVG with color

Can somebody help me with css and javascript? 有人可以通过CSS和javascript帮助我吗? I need to create a page with scroll animation. 我需要用滚动动画创建一个页面。 https://meetlima.com/how-it-works.php?lang=en The 1,2,3 must be filled with color. https://meetlima.com/how-it-works.php?lang=zh-CN 1,2,3必须填充颜色。

 <div class="container"> <div class="een"> <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ --> <g> <title>Layer 1</title> <text stroke="#000000" transform="matrix(9.676384925842285,0,0,9.676384925842285,-1584.9315026253462,-1064.0772700458765) " xml:space="preserve" text-anchor="middle" font-family="Fantasy" font-size="24" id="svg_1" y="129.86676" x="174.14887" stroke-width="0" fill="#bfbfbf">1</text> </g> </svg> </div> </div> 

In fact on page you've shared as exapmle the svg numbers have transparent color. 实际上,您在页面上共享的svg数字具有透明的颜色。

Initially you see grey background of div.how-it-works__step__bg__inner . 最初,您会看到div.how-it-works__step__bg__inner的灰色背景。

On backface there is a div.how-it-works__faker which has fixed position and lowest z-index. 背面有一个div.how-it-works__faker ,它具有固定位置和最低z-index。 Also has inner element div.how-it-works__faker__inner with blue background 也具有蓝色背景的内部元素div.how-it-works__faker__inner

And when you scrolling down you may see the part of div.how-it-works__faker__inner under svg image. 向下滚动时,您可能会在svg图像下看到div.how-it-works__faker__inner的一部分。

to make it more clear check this screen just to understand what would happens in case you set higher z-index for div.how-it-works__faker 为了使其更加清晰,请检查此屏幕,以了解如果为div.how-it-works__faker设置了更高的z-index会发生什么情况

screenshot 截图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM