In the following code example, a linear gradient fills a rectangle. The gradient is defined in a definition and fills the rectangle by referencing the gradient. The gradient runs from magenta to cyan.
Copy this sample to a text file and save it with the .html file extension. Run it in Internet Explorer 9 to see the magenta-to-cyan gradient-filled rectangle.
The gradient-filled rectangle will look like this:
<!DOCTYPE HTML>
<html>
<head></head>
<body>
<svg width="400" height="400">
<defs>
<linearGradient id="magenta2cyan" >
<stop offset="0%" style="stop-color:magenta"/>
<stop offset="100%" style="stop-color:cyan"/>
</linearGradient>
</defs>
<rect width="100" height="50" x="50" y="50" style="fill:url(#magenta2cyan)"/>
</svg>
</body>
</html>
Notes Remarks
Note: In addition to the attributes, properties, events, methods, and styles listed above, SVG elements also inherent core HTML attributes, properties, events, methods, and styles.
Standards informationThe SVGLinearGradientElement object has these properties:
Microsoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4