SVG gradient using CSS

前端 未结 6 1261
粉色の甜心
粉色の甜心 2020-11-29 19:58

I\'m trying to get a gradient applied to an SVG rect element.

Currently, I\'m using the fill attribute. In my CSS file:

rec         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 20:05

    Thank you everyone, for all your precise replys.

    Using the svg in a shadow dom, I add the 3 linear gradients I need within the svg, inside a . I place the css fill rule on the web component and the inheritance od fill does the job.

        
          
        
        
        
          
            
            
            
          
        
        
        

    The first one is normal SVG, the second one is inside a shadow dom.

提交回复
热议问题