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
code
ofNO_MODIFICATION_ALLOWED_ERR
if the rule is read-only or acode
ofSYNTAX_ERR
if 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 thestyle
property 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 ...
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.