CSS 3 gradients for styling SVG elements

后端 未结 1 741
攒了一身酷
攒了一身酷 2021-01-05 01:54

Is it possible to use CSS3 gradients for styling fill property?

I know that SVG provides their own gradients. But the ideal solution for me would be:



        
相关标签:
1条回答
  • 2021-01-05 02:22

    No it's not yet possible to use CSS3 gradients for the fill property. The good news though is that it's being discussed by the CSS and SVG workgroups, and SVG.next will depend on CSS3 Image Values (which defines the CSS gradient syntax). See http://www.w3.org/2011/07/29-svg-minutes.html#item08.

    Note that the base url for the fill:url(...) by default is the file that contains this rule. So if you want to move fill:url(#linearGradientXYZ) to an external stylesheet remember to add the full path to the file containing that gradient definition, eg. fill:url(../images/gradients.svg#linearGradientXYZ).

    0 讨论(0)
提交回复
热议问题