Name
CSSRule — a rule in a CSS style sheet
Availability
DOM Level 2 CSS
Subinterfaces
CSSCharsetRule, CSSFontFaceRule, CSSImportRule, CSSMediaRule, CSSPageRule, CSSStyleRule, CSSUnknownRule
Constants
These constants represent the various types of rules that may appear
in a CSS style sheet. They are the legal values of the
type property, and they specify which of the above
subinterfaces this object implements.
unsigned short UNKNOWN_RULE = 0; // CSSUnknownRule unsigned short STYLE_RULE = 1; // CSSStyleRule unsigned short CHARSET_RULE = 2; // CSSCharsetRule unsigned short IMPORT_RULE = 3; // CSSImportRule unsigned short MEDIA_RULE = 4; // CSSMediaRule unsigned short FONT_FACE_RULE = 5; // CSSFontFaceRule unsigned short PAGE_RULE = 6; // CSSPageRule
Properties
-
String cssText The textual representation of the rule. If you set this property, it may throw a DOMException with one of the following
codevalues for one of the following reasons:-
HIERARCHY_REQUEST_ERR The specified rule is not legal at this location in the style sheet.
-
INVALID_MODIFICATION_ERR The new value of the property is a rule of a different type than the original value.
-
NO_MODIFICATION_ALLOWED_ERR The rule or the style sheet that contains it is read-only.
-
SYNTAX_ERR The specified string is not legal CSS syntax.
-
readonlyCSSRuleparentRule The containing rule of this rule, or
nullif this rule does not have a parent. An example of a CSS rule with a parent is a style rule within an@mediarule.-
readonlyCSSStyleSheet ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access