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 741863 of CSSStyleRule

  • Revision slug: Web/API/CSSStyleRule
  • Revision title: CSSStyleRule
  • Revision id: 741863
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment

Revision Content

{{ APIRef("CSSOM") }}

CSSStyleRule represents a single CSS style rule. It implements the {{domxref("CSSRule")}} interface with a type value of 1 (CSSRule.STYLE_RULE).

Syntax

The syntax is described using the WebIDL format.

interface CSSStyleRule : CSSRule {
    attribute DOMString selectorText;
    readonly attribute CSSStyleDeclaration style;
};

Properties

{{domxref("CSSStyleRule.selectorText")}}
Gets the textual representation of the selector for this rule, e.g. "h1,h2".
{{domxref("CSSStyleRule.style")}} {{readonlyinline}}
Returns the {{domxref("CSSStyleDeclaration")}} object for the rule. Read only.

Specification

Specification Status Comment
{{ SpecName('CSSOM', '#the-cssstylerule-interface', 'CSSStyleRule') }} {{ Spec2('CSSOM') }} No changes
{{ SpecName('DOM2 Style', 'css.html#CSS-CSSStyleRule', 'CSSRule') }} {{ Spec2('DOM2 Style') }}  

Browser compatibility

To get browser compatibility information about the different type constant value, please consult the compatibility table of the associated interface.

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}
 
{{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}

See also

  • {{CSSOM}}

Revision Source

<p>{{ APIRef("CSSOM") }}</p>

<p><strong><code>CSSStyleRule</code></strong> represents a single CSS style rule. It implements the {{domxref("CSSRule")}} interface with a type value of <code>1</code> (<code>CSSRule.STYLE_RULE</code>).</p>

<h2 id="Properties" name="Properties">Syntax</h2>

<p>The syntax is described using the <a class="external" href="https://dev.w3.org/2006/webapi/WebIDL/" title="https://dev.w3.org/2006/webapi/WebIDL/">WebIDL</a> format.</p>

<pre>
interface CSSStyleRule : CSSRule {
&nbsp;&nbsp;&nbsp; attribute DOMString selectorText;
&nbsp;&nbsp;&nbsp; readonly attribute CSSStyleDeclaration style;
};</pre>

<h2 id="Properties_2">Properties</h2>

<dl>
 <dt id="selectorText">{{domxref("CSSStyleRule.selectorText")}}</dt>
 <dd>Gets the textual representation of the selector for this rule, e.g. <code>"h1,h2"</code>.</dd>
 <dt id="style">{{domxref("CSSStyleRule.style")}} {{readonlyinline}}</dt>
 <dd>Returns the {{domxref("CSSStyleDeclaration")}} object for the rule. <strong>Read only.</strong></dd>
</dl>

<h2 id="Specification" name="Specification">Specification</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{ SpecName('CSSOM', '#the-cssstylerule-interface', 'CSSStyleRule') }}</td>
   <td>{{ Spec2('CSSOM') }}</td>
   <td>No changes</td>
  </tr>
  <tr>
   <td>{{ SpecName('DOM2 Style', 'css.html#CSS-CSSStyleRule', 'CSSRule') }}</td>
   <td>{{ Spec2('DOM2 Style') }}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>To get browser compatibility information about the different type constant value, please consult the compatibility table of the associated interface.</p>

<p>{{ CompatibilityTable() }}</p>

<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>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</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&nbsp;Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}<br />
    &nbsp;</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{CSSOM}}</li>
</ul>
Revert to this revision