O'Reilly logo

Designing SVG Web Graphics by Andrew H. Watt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The <linearGradient> Element

Linear gradients in SVG can be defined as horizontal gradients, vertical gradients, or diagonally at any angle between the horizontal and vertical. A horizontal gradient is created when the values of the y1 and y2 attributes of the <linearGradient> element are the same and the x1 and x2 attributes differ. A vertical gradient results when the x1 and x2 attributes or the <linearGradient> element are the same and the y1 and y2 attributes differ. A diagonal gradient results when both pairs of attributes differ.

A linear gradient can have two colors or many colors. Each color used in a gradient is specified using a <stop> element, which has stop-color and stop-opacity attributes. SVG also allows you to vary individually ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required