Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 449617 of HTMLStyleElement

  • Revision slug: Web/API/HTMLStyleElement
  • Revision title: HTMLStyleElement
  • Revision id: 449617
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{DOMRef}}

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, and false 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 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}} {{CompatVersionUnknown}} {{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}} {{CompatVersionUnknown}} {{CompatNo}} {{CompatNo}} {{CompatNo}}

See also

Revision Source

<div>
  {{DOMRef}}</div>
<p>The <strong><code>HTMLStyleElement</code></strong> interface represents a {{HTMLElement("style")}} element. It inherits properties and methods from its parent, {{domxref("HTMLElement")}}, and from {{domxref("LinkStyle")}}.</p>
<p>This interface doesn't allow to manipulate the CSS it contains (in most case). To manipulate CSS, see <a href="/en-US/docs/DOM/Using_dynamic_styling_information" title="DOM/Using_dynamic_styling_information">Using dynamic styling information</a> for an overview of the objects used to manipulate specified CSS properties using the DOM.</p>
<h2 id="Properties">Properties</h2>
<p><em>Inherits properties from its parent, {{domxref("HTMLElement")}}</em><em>, and implements {{domxref("LinkStyle")}}</em><em>.</em></p>
<dl>
  <dt>
    {{domxref("HTMLStyleElement.media")}}</dt>
  <dd>
    Is a {{domxref("DOMString")}} representing the intended destination medium for style information.</dd>
  <dt>
    {{domxref("HTMLStyleElement.type")}}</dt>
  <dd>
    Is a {{domxref("DOMString")}} representing the type of style being applied by this statement.</dd>
  <dt>
    {{domxref("HTMLStyleElement.disabled")}}</dt>
  <dd>
    Is a {{domxref("Boolean")}} value, with <code>true</code> if the stylesheet is disabled, and <code>false</code> if not.</dd>
  <dt>
    {{domxref("LinkStyle.sheet")}} {{readonlyInline}}</dt>
  <dd>
    Returns the {{domxref("StyleSheet")}} object associated with the given element, or <code>null</code> if there is none</dd>
  <dt>
    {{domxref("HTMLStyleElement.scoped")}}</dt>
  <dd>
    Is a {{domxref("Boolean")}} value indicating if the element applies to the whole document (<code>false</code>) or only to the parent's sub-tree (<code>true</code>).</dd>
</dl>
<h2 id="Methods">Methods</h2>
<p><em>No specific method; inherits properties from its parent, {{domxref("HTMLElement")}}</em><em>, and {{domxref("LinkStyle")}}</em><em>.</em></p>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
  <tbody>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
    <tr>
      <td>{{SpecName('HTML WHATWG', "semantics.html#the-style-element", "HTMLStyleElement")}}</td>
      <td>{{Spec2('HTML WHATWG')}}</td>
      <td>No change from {{SpecName("HTML5 W3C")}}.</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML5 W3C', "document-metadata.html#the-style-element", "HTMLStyleElement")}}</td>
      <td>{{Spec2('HTML5 W3C')}}</td>
      <td>The following property has been added: <code>scoped</code>.</td>
    </tr>
    <tr>
      <td>{{SpecName('DOM2 HTML', 'html.html#ID-16428977', 'HTMLStyleElement')}}</td>
      <td>{{Spec2('DOM2 HTML')}}</td>
      <td>Added a second inheritence, the {{domxref("LinkStyle")}} interface.</td>
    </tr>
    <tr>
      <td>{{SpecName('DOM1', 'level-one-html.html#ID-16428977', 'HTMLStyleElement')}}</td>
      <td>{{Spec2('DOM1')}}</td>
      <td>Initial definition.</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
  {{CompatibilityTable}}</div>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari (WebKit)</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoDesktop(1.0)}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
      <tr>
        <td><code>scoped</code></td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoMobile(1.0)}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
      <tr>
        <td><code>scoped</code></td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li>The HTML element implementing this interface: {{HTMLElement("style")}}.</li>
  <li><a href="/en-US/docs/DOM/Using_dynamic_styling_information" title="DOM/Using_dynamic_styling_information">Using dynamic styling information</a> to see how to manipulate CSS.</li>
</ul>
Revert to this revision