rule object
Represents a style within a style sheet that consists of a selector and one or more declarations.
Members
The rule object has these types of members:
Properties
The rule object has these properties.
| Property | Description |
|---|---|
|
Returns a reference to the constructor of an object. | |
|
Sets or retrieves the persisted representation of the style rule. | |
|
Retrieves the containing rule, if the current rule is contained inside another rule. | |
|
Retrieves the style sheet that contains the current rule. | |
|
Retrieves whether the rule or style sheet is defined on the document or is imported. | |
|
Retrieves a string that identifies which elements the corresponding style sheet rule applies to. | |
|
Retrieves the type of the rule. |
Standards information
There are no standards that apply here.
Remarks
The rule object defines a set of Cascading Style Sheets (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.
Examples
This example uses a rule object consisting of the selector H1 to define a single rule that changes the H1 headings in a document to red.
<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
Send comments about this topic to Microsoft
Build date: 11/29/2012