{{APIRef}}
The HTMLStyleElement
interface represents a {{HTMLElement("style")}} element. It inherits properties and methods from its parent, {{domxref("HTMLElement")}}, and from {{domxref("LinkStyle")}}.
This interface doesn't allow to manipulate the CSS it contains (in most case). To manipulate CSS, see Using dynamic styling information for an overview of the objects used to manipulate specified CSS properties using the DOM.
Properties
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, with
true
if the stylesheet is disabled, andfalse
if not. - {{domxref("LinkStyle.sheet")}} {{readonlyInline}}
-
Returns the {{domxref("StyleSheet")}} object associated with the given element, or
null
if there is none - {{domxref("HTMLStyleElement.scoped")}}
-
Is a {{domxref("Boolean")}} value indicating if the element applies to the whole document (
false
) or only to the parent's sub-tree (true
).
Methods
No specific method; inherits properties from its parent, {{domxref("HTMLElement")}}, and {{domxref("LinkStyle")}}.
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', "semantics.html#the-style-element", "HTMLStyleElement")}} | {{Spec2('HTML WHATWG')}} | No change from {{SpecName("HTML5 W3C")}}. |
{{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. |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoDesktop(1.0)}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
scoped |
{{CompatUnknown}} | {{CompatGeckoDesktop(21.0)}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoMobile(1.0)}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
scoped |
{{CompatUnknown}} | {{CompatGeckoMobile(21.0)}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
See also
- The HTML element implementing this interface: {{HTMLElement("style")}}.
- Using dynamic styling information to see how to manipulate CSS.