ICSSStyleSheet Interface

ICSSStyleSheet interface

The CSSStyleSheet interface represents a single CSS stylesheet, and lets you inspect and modify the list of rules contained in the stylesheet. It inherits properties and methods from its parent, StyleSheet.

A stylesheet consists of a collection of CSSRule objects representing each of the rules in the stylesheet. The rules are contained in a CSSRuleList, which can be obtained from the stylesheet’s cssRules property.

For example, one rule might be a CSSStyleRule object containing a style such as

h1, h2 {   font-size: 16pt; }

Another rule might be an at-rule such as @import or @media, and so forth.

public interface ICSSStyleSheet : IStyleSheet

Properties

NameDescription
getCSSRules The read-only CSSStyleSheet property cssRules returns a live CSSRuleList which provides a real-time, up-to-date list of every CSS rule which comprises the stylesheet. Each item in the list is a CSSRule defining a single rule.
getOwnerRule The read-only CSSStyleSheet property ownerRule returns the CSSImportRule corresponding to the @import at-rule which imported the stylesheet into the document. If the stylesheet wasn’t imported into the document using @import, the returned value is null.

Methods

NameDescription
deleteRule(int)The CSSStyleSheet method deleteRule() removes a rule from the stylesheet object.
insertRule(String, int)The CSSStyleSheet.insertRule() method inserts a new CSS rule into the current style sheet, with some restrictions.

Remarks

CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and of course CSS itself.

Reference

CSS Working Group - The CSS Working Group is the W3C working group chartered to develop Cascading Style Sheets (CSS).CSS Object Model (CSSOM) - CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and of course CSS itself.CSS Object Model (CSSOM) # cssstylesheet – The CSSOM definition.

See Also