--- title: HTMLStyleElement slug: Web/API/HTMLStyleElement tags: - API - HTML DOM - HTMLStyleElement - Reference translation_of: Web/API/HTMLStyleElement ---
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")}}.
null
if there is nonefalse
) 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")}}