public interface CssStyleSheet extends StyleSheet
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 CSSStyleRule interface, which in turn implements CSSRule. 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.
Modifier and Type | Method and Description |
---|---|
void |
deleteRule(int index)
Used to delete a rule from the style sheet.
|
CssRuleList |
getCssRules()
The list of all CSS rules contained within the style sheet
|
CssRule |
getOwnerRule()
If this style sheet comes from an @import rule, the ownerRule attribute will contain the CSSImportRule.
|
int |
insertRule(java.lang.String rule,
int index)
Used to insert a new rule into the style sheet.
|
getHref, getMedia, getOwnerNode, getParentStyleSheet, getTitle, getType, isDisabled, setDisabled
CssRuleList getCssRules()
CssRule getOwnerRule()
void deleteRule(int index)
index
- The index within the style sheet's rule list of the rule to remove.int insertRule(java.lang.String rule, int index)
rule
- The parsable text representing the rule. For rule sets this contains both the selector and
the style declaration. For at-rules, this specifies both the at-identifier and the rule
content.index
- The index within the style sheet's rule list of the rule before which to insert the
specified rule. If the specified index is equal to the length of the style sheet's rule
collection, the rule will be added to the end of the style sheet.