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

symbol元素用来定义一个图形模板对象,它可以用一个{{ SVGElement("use") }}元素实例化。symbol元素对图形的作用是在同一文档中多次使用,添加结构和语义。结构丰富的文档可以更生动地呈现出来,类似讲演稿或盲文,从而提升了可访问性。注意,一个symbol元素本身是不呈现的。只有symbol元素的实例(亦即,一个引用了symbol的 {{ SVGElement("use") }}元素)才能呈现。

+ +

用法

+ +

{{svginfo}}

+ +

示例

+ +
<svg>
+<!-- symbol definition  NEVER draw -->
+<symbol id="sym01" viewBox="0 0 150 110">
+  <circle cx="50" cy="50" r="40" stroke-width="8" stroke="red" fill="red"/>
+  <circle cx="90" cy="60" r="40" stroke-width="8" stroke="green" fill="white"/>
+</symbol>
+
+<!-- actual drawing by "use" element -->
+<use xlink:href="#sym01"
+     x="0" y="0" width="100" height="50"/>
+<use xlink:href="#sym01"
+     x="0" y="50" width="75" height="38"/>
+<use xlink:href="#sym01"
+     x="0" y="100" width="50" height="25"/>
+</svg>
+
+ +

{{EmbedLiveSample("Example", 150, 110)}}

+ +

属性

+ +

全局属性

+ + + +

专有属性

+ + + +

DOM 接口

+ +

该元素实现了SVGSymbolElement接口。

+ +

浏览器兼容性

+ +

{{ CompatibilityTable() }}

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

该表格基于这些资源

+ +

另见

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