Name
CSSRule: a rule in a CSS stylesheet — DOM Level 2 CSS, IE 5: Object → CSSRule
Properties
-
String selectorText The selector text that specifies the document elements this style rule applies to. Setting this property raises a DOMException with a
codeofNO_MODIFICATION_ALLOWED_ERRif the rule is read-only or acodeofSYNTAX_ERRif the new value does not follow CSS syntax rules.-
readonly CSS2Properties style The style values that should be applied to elements specified by
selectorText. Note that while thestyleproperty itself is read-only, the properties of the CSS2Properties object to which it refers are read/write.
Description
A CSSRule object represents a rule in a CSS stylesheet: it
represents style information to be applied to a specific set of
document elements. selectorText
is the string representation of the element selector for this rule,
and style is a CSS2Properties
object that represents the set of style attributes and values to
apply to the selected elements.
The DOM Level 2 CSS specification actually defines a somewhat complex hierarchy of CSSRule interfaces to represent different types of rules that can appear in a CSSStyleSheet. The properties listed here are actually defined by the DOM CSSStyleRule interface. Style rules are the most common and most important types of rules in a stylesheet, and the properties listed here are the only ones that can be used portably across browsers. IE does not support the DOM Level 2 specification very well (at least not through IE ...
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