Answer the question
In order to leave comments, you need to log in
How to use color and pattern together in SVG?
An irregularly shaped figure is created, filled with a gradient, but how to use a pattern as well? It should be on top of the gradient and inside the
HTML shape:
<svg id="svg" viewBox="0 0 1000 1000">
<defs>
<linearGradient id="lgrad" x1="7%" y1="0%" x2="93%" y2="100%" >
<stop offset="0%" style="stop-color:rgb(255,29,139);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(255,255,255);stop-opacity:1" />
</linearGradient>
<pattern id="pattern-bg" x="0" y="0" width="20" height="20" viewBox ='0 0 80 80' patternUnits="userSpaceOnUse">
<circle fill="0x0" cx="3" cy="3" r="2.5"></circle>
</pattern>
</defs>
<path id="path3"></path>
</svg>
#path3 {
fill: url(#lgrad);
}
Answer the question
In order to leave comments, you need to log in
https://stackoverflow.com/a/60395056/6339052
In English SO they gave one single correct answer ... I'm nick and really a task that I did not know
<svg id="svg" viewBox="0 0 1000 1000">
<defs>
<linearGradient id="grad" x1="7%" y1="0%" x2="93%" y2="100%" >
<stop offset="0%" style="stop-color:rgb(255,29,139);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(255,255,255);stop-opacity:1" />
</linearGradient>
<pattern id="bg" x="0" y="0" width="20" height="20" viewBox ='0 0 80 80' patternUnits="userSpaceOnUse">
<circle fill="0x0" cx="3" cy="3" r="2.5"></circle>
</pattern>
<pattern id="both" width="100%" height="100%">
<rect width="100%" height="100%" fill="url(#grad)"/>
<rect width="100%" height="100%" fill="url(#bg)"/>
</pattern>
</defs>
<g>
<path id="path3" d="M0,0 1000,0 1000,1000 0,1000z" fill="url(#both)"></path>
</g>
</svg>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question