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/api/htmlstyleelement/index.html | 90 +++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 files/zh-cn/web/api/htmlstyleelement/index.html (limited to 'files/zh-cn/web/api/htmlstyleelement/index.html') diff --git a/files/zh-cn/web/api/htmlstyleelement/index.html b/files/zh-cn/web/api/htmlstyleelement/index.html new file mode 100644 index 0000000000..c54eaee1e2 --- /dev/null +++ b/files/zh-cn/web/api/htmlstyleelement/index.html @@ -0,0 +1,90 @@ +--- +title: HTMLStyleElement +slug: Web/API/HTMLStyleElement +tags: + - API + - HTML DOM + - HTMLStyleElement + - Reference +translation_of: Web/API/HTMLStyleElement +--- +
+
{{APIRef("HTML DOM")}}
+
+ +

HTMLStyleElement 接口表示 {{HTMLElement("style")}} 元素。它从 {{domxref("HTMLElement")}} 和 {{domxref("LinkStyle")}} 中继承属性和方法。

+ +

这个接口不允许修改包含其中的CSS(大多数情况下)。如果需要修改CSS,前往关于使用动态样式的信息查看在DOM中用于修改特定CSS属性的对象。

+ +

{{InheritanceDiagram(600, 120)}}

+ +

属性

+ +

Inherits properties from its parent, {{domxref("HTMLElement")}}, and implements {{domxref("LinkStyle")}}.

+ +
+
{{domxref("HTMLStyleElement.media")}}
+
Is a {{domxref("DOMString")}} representing the intended destination medium for style information.
+
{{domxref("HTMLStyleElement.type")}}
+
Is a {{domxref("DOMString")}} representing the type of style being applied by this statement.
+
{{domxref("HTMLStyleElement.disabled")}}
+
Is a {{domxref("Boolean")}} value representing whether or not the stylesheet is disabled (true) or not (false).
+
{{domxref("LinkStyle.sheet")}} {{readonlyInline}}
+
Returns the {{domxref("StyleSheet")}} object associated with the given element, or null if there is none
+
{{domxref("HTMLStyleElement.scoped")}} {{non-standard_inline}} {{obsolete_inline}}
+
Is a {{domxref("Boolean")}} value indicating if the element applies to the whole document (false) or only to the parent's sub-tree (true).
+
+ +

方法

+ +

No specific method; inherits properties from its parent, {{domxref("HTMLElement")}}, and {{domxref("LinkStyle")}}.

+ +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
规范状态注释
{{SpecName('HTML WHATWG', "#htmlstyleelement", "HTMLStyleElement")}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', "document-metadata.html#the-style-element", "HTMLStyleElement")}}{{Spec2('HTML5.1')}}
{{SpecName('HTML5 W3C', "document-metadata.html#the-style-element", "HTMLStyleElement")}}{{Spec2('HTML5 W3C')}}The following property has been added: scoped.
{{SpecName('DOM2 HTML', 'html.html#ID-16428977', 'HTMLStyleElement')}}{{Spec2('DOM2 HTML')}}Added a second inheritence, the {{domxref("LinkStyle")}} interface.
{{SpecName('DOM1', 'level-one-html.html#ID-16428977', 'HTMLStyleElement')}}{{Spec2('DOM1')}}Initial definition
+ +

浏览器兼容性

+ + + +

{{Compat("api.HTMLStyleElement")}}

+ +

参见

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