From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/svg/element/lineargradient/index.html | 128 +++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 files/zh-cn/web/svg/element/lineargradient/index.html (limited to 'files/zh-cn/web/svg/element/lineargradient/index.html') diff --git a/files/zh-cn/web/svg/element/lineargradient/index.html b/files/zh-cn/web/svg/element/lineargradient/index.html new file mode 100644 index 0000000000..e9b7172c09 --- /dev/null +++ b/files/zh-cn/web/svg/element/lineargradient/index.html @@ -0,0 +1,128 @@ +--- +title: linearGradient +slug: Web/SVG/Element/linearGradient +tags: + - SVG + - SVG渐变 + - 元素 +translation_of: Web/SVG/Element/linearGradient +--- +
{{SVGRef}}
+ +

linearGradient元素用来定义线性渐变,用于图形元素的填充或描边。

+ +

用法

+ +

{{svginfo}}

+ +

示例

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

{{EmbedLiveSample("Example", 120, 120, "https://mdn.mozillademos.org/files/10061/svg-lineargradient.png")}}

+ +

属性

+ +

Global 属性

+ + + +

专有属性

+ + + +

DOM 接口

+ +

该元素实现了SVGLinearGradientElement接口。

+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)IEOperaSafari
Basic support1.0{{ CompatGeckoDesktop('1.8') }}{{ CompatIE('9.0') }}{{ CompatOpera('9.0') }}{{ CompatSafari('3.0.4') }}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatAndroid('3.0') }}{{ CompatGeckoMobile('1.8') }}{{CompatNo}}{{ CompatVersionUnknown}}{{ CompatSafari('3.0.4') }}
+
+ +

该表格基于这些资源

+ +

 

+ +

[1] WebKit不支持spread方法 (bug 5968) 以及颜色插值 (bug 6034)。

+ +

参见

+ + -- cgit v1.2.3-54-g00ecf