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 ...

Get Designing SVG Web Graphics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.