Perhaps more exciting than just fills and strokes is the fact that you can also create and apply gradients as either fills or strokes. There are two types of gradients: linear and radial. You must give the gradient an id attribute; otherwise it can't be referenced by other elements inside the file.
How do you fill an SVG with a linear gradient?
Just use in the CSS whatever you would use in a fill attribute. Of course, this requires that you have defined the linear gradient somewhere in your SVG. So I created that gradient in a separate file, and used fill this way: fill: url(../js/gradient. svg#MyGradient); .
How do you use LinearGradient?
The linear-gradient() function sets a linear gradient as the background image. To create a linear gradient you must define at least two color stops. Color stops are the colors you want to render smooth transitions among. You can also set a starting point and a direction (or an angle) along with the gradient effect.