Represents a style within a cascading style sheet (CSS) that consists of a selector and one or more declarations.
Remarks
The rule object defines a set of CSS attributes applied to a set of HTML elements. For example, a rule consisting of the selector H1 and the declaration font-family:Arial defines all H1 elements to render in the Arial font.
This object is available in script as of Microsoft® Internet Explorer 5.
Members
Example
This example uses a rule object consisting of the selector H1 to define a single rule that changes the H1 heading(s) in a document to red.
Sample Code
<STYLE> H1 { color: red } </STYLE>If the style sheet containing the preceding rule is the first style sheet in the document, the following code returns the rule object associated with the rule.
oRule=document.styleSheets(0).rules(0)
See Also