XML technologies / SVG / Filters, transformations and gradients / Defining and assigning gradients / Assigning a gradient to an element
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
An object to receive the gradient is still needed. For a round button, a circle is suitable; create it with the <circle> tag. Assign the gradient by setting the circle’s style attribute’s fill property using fill:url(#runderVerlauf). Here, runderVerlauf is the gradient name specified in its id attribute.
<?xml version="1.0" standalone="no"?>
<svg>
...
<radialGradient id="runderVerlauf" cx="40%" cy="75%" r="50%">
...
</radialGradient>
<circle cx="200" cy="200" r="25" style="stroke-width:1;stroke-opacity:0.8;stroke:rgb(222,0,0);fill-opacity:1;opacity:1;fill:url(#runderVerlauf)"/>
</svg>
Figure: Source code result in the browser.
Copyright © verlag moderne industrie GmbH 2001
You may print the online version for your private use.
Otherwise, this chapter from “Das Einsteigerseminar SVG — Webgrafiken mit XML” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
verlag moderne industrie GmbH, Justus-von-Liebig-Straße 1, D-86899 Landsberg/Lech, fon ++49 (0) 81 91 / 125 – 0, leserservice(at)mi-verlag.de
back to top