CSSStyleSheet

  • Revision slug: DOM/CSSStyleSheet
  • Revision title: CSSStyleSheet
  • Revision id: 86012
  • Created:
  • Creator: Sevenspade
  • Is current revision? No
  • Comment on second thought, just don't link these properties if they aren't going to a dedicated page describing them; one or more formatting changes

Revision Content

{{ DomRef() }}

An object implementing the CSSStyleSheet interface represents a single CSS style sheet.

A CSS style sheet consists of CSS rules, each of which can be manipulated through an object that corresponds to that rule and that implements the CSSRule interface. The CSSStyleSheet itself lets you examine and modify its corresponding style sheet, including its list of rules.

In practice, every CSSStyleSheet also implements the more generic StyleSheet interface. A list of CSSStyleSheet-implementing objects corresponding to the style sheets for a given document can be reached by the document.styleSheets property, if the document is styled by an external CSS style sheet or an inline style element.

Properties

cssRules
Returns a CSSRuleList of the CSS rules in the style sheet.
ownerRule
If this style sheet is imported into the document using an @import rule, the ownerRule property will return that CSSImportRule, otherwise it returns null.

Methods

deleteRule
Deletes a rule from the style sheet.
insertRule
Inserts a new style rule into the current style sheet.

Specification

DOM Level 2 CSS: CSSStyleSheet

See also

{{ languages( { "pl": "pl/DOM/stylesheet" } ) }}

Revision Source

<p>{{ DomRef() }}</p>
<p>An object implementing the <code>CSSStyleSheet</code> interface represents a single <a href="/en/CSS" title="en/CSS">CSS</a> style sheet.</p>
<p>A CSS style sheet consists of CSS rules, each of which can be manipulated through an object that corresponds to that rule and that implements the <code><a href="/en/DOM/cssRule" title="en/DOM/cssRule">CSSRule</a></code> interface. The <code>CSSStyleSheet</code> itself lets you examine and modify its corresponding style sheet, including its list of rules.</p>
<p>In practice, every <code>CSSStyleSheet</code> also implements the more generic <code><a href="/en/DOM/stylesheet" title="en/DOM/StyleSheet">StyleSheet</a></code> interface. A list of <code>CSSStyleSheet</code>-implementing objects corresponding to the style sheets for a given document can be reached by the <code><a href="/en/DOM/document.styleSheets" title="en/DOM/document.styleSheets">document.styleSheets</a></code> property, if the document is styled by an external CSS style sheet or an inline <code><a href="/en/HTML/Element/style" title="en/HTML/element/style">style</a></code> element.</p>
<h2 name="Properties">Properties</h2>
<dl> <dt id="cssRules"><code>cssRules</code></dt> <dd>Returns a <code><a href="/en/DOM/CSSRuleList" title="en/DOM/CSSRuleList">CSSRuleList</a></code> of the CSS rules in the style sheet.</dd> <dt id="ownerRule"><code>ownerRule</code></dt> <dd>If this style sheet is imported into the document using an <code><a href="/en/CSS/@import" title="en/CSS/@import">@import</a></code> rule, the <code>ownerRule</code> property will return that <code><a href="/en/DOM/CSSImportRule" title="en/DOM/CSSImportRule">CSSImportRule</a></code>, otherwise it returns <code>null</code>.</dd>
</dl><h2 name="Methods">Methods</h2>
<dl> <dt id="deleteRule"><code><a href="/en/DOM/CSSStyleSheet/deleteRule" title="en/DOM/CSSStyleSheet/deleteRule">deleteRule</a></code></dt> <dd>Deletes a rule from the style sheet.</dd> <dt id="insertRule"><code><a href="/en/DOM/CSSStyleSheet/insertRule" title="en/DOM/CSSStyleSheet/insertRule">insertRule</a></code></dt> <dd>Inserts a new style rule into the current style sheet.</dd>
</dl>
<h2 name="Specification">Specification</h2>
<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet">DOM Level 2 CSS: CSSStyleSheet</a></p>
<h2 name="See also">See also</h2>
<ul> <li><code><a href="/en/DOM/stylesheet" title="en/DOM/StyleSheet">StyleSheet</a></code></li>
</ul>
<p>{{ languages( { "pl": "pl/DOM/stylesheet" } ) }}</p>
Revert to this revision