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/style/index.html | 116 +++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 files/zh-cn/web/svg/element/style/index.html (limited to 'files/zh-cn/web/svg/element/style') diff --git a/files/zh-cn/web/svg/element/style/index.html b/files/zh-cn/web/svg/element/style/index.html new file mode 100644 index 0000000000..aa8f886674 --- /dev/null +++ b/files/zh-cn/web/svg/element/style/index.html @@ -0,0 +1,116 @@ +--- +title: style +slug: Web/SVG/Element/style +tags: + - SVG + - 元素 + - 参考 +translation_of: Web/SVG/Element/style +--- +
{{SVGRef}}
+ +

style元素元素样式表直接在SVG内容中间嵌入。SVG的style元素的属性与HTML中的相应的元素并无二致(请阅读HTML的 {{HTMLElement("style")}} 元素)。

+ +

用法

+ +

{{svginfo}}

+ +

示例

+ +
<svg width="100%" height="100%" viewBox="0 0 100 100"
+     xmlns="http://www.w3.org/2000/svg">
+  <style>
+    /* <![CDATA[ */
+    circle {
+      fill: orange;
+      stroke: black;
+      stroke-width: 10px; // Note that the value of a pixel depend on the viewBox
+    }
+    /* ]]> */
+  </style>
+
+  <circle cx="50" cy="50" r="40" />
+</svg>
+
+ +

示例输出

+ +

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

+ +

属性

+ +

全局属性

+ + + +

专有属性

+ + + +

DOM 接口

+ +

该元素实现了SVGStyleElement接口。

+ +

浏览器兼容性

+ +

{{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