我们的志愿者还没有将这篇文章翻译为 中文 (简体) 。加入我们帮助完成翻译!

    The linearGradient element lets authors define linear gradients to fill or stroke graphical elements.

    Usage context

    Categories Gradient element
    Permitted content Any number of the following elements, in any order:
    Descriptive elements »
    <animate>, <animateTransform>, <set>, <stop>
    Normative document SVG 1.1 (2nd Edition)


    <svg width="120" height="120"  viewBox="0 0 120 120"
         xmlns="" version="1.1"
         xmlns:xlink="" >
            <linearGradient id="MyGradient">
                <stop offset="5%"  stop-color="green"/>
                <stop offset="95%" stop-color="gold"/>
        <rect fill="url(#MyGradient)"
              x="10" y="10" width="100" height="100"/>

    ScreenshotLive sample


    Global attributes

    Specific attributes

    DOM Interface

    This element implements the SVGLinearGradientElement interface.

    Browser compatibility

    Feature Chrome Firefox (Gecko) IE Opera Safari
    Basic support 1.0 1.5 (1.8) 9.0 9.0 3.0.4
    Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support 3.0 1.0 (1.8) Not supported (Yes) 3.0.4

    The chart is based on these sources.

    WebKit-specific notes

    WebKit doesn't support spreadMethod (bug 5968) and color interpolation (bug 6034).

    See also


    此页面的贡献者有: Sheppy, Manuel_Strehl, kscarfone, fscholz, Jeremie
    最后编辑者: fscholz,